You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
uml-task/routes/address.js

33 lines
909 B

const express = require("express");
const router = express.Router();
const {
getAddressServices,
addAddressServices,
updateAddressServices,
deleteAddressServices,
} = require("../services/addressService");
const { formatResponse } = require("../utils/tools");
router.get("/", async function (req, res, next) {
const data = await getAddressServices();
res.send(formatResponse(0, "", data));
});
router.post("/", async function (req, res, next) {
console.log(req, res);
const data = await addAddressServices(req.body);
res.send(formatResponse(0, "", data));
});
router.put("/", async function (req, res, next) {
const data = await updateAddressServices(req.body);
res.send(formatResponse(0, "", data));
});
router.delete("/", async function (req, res, next) {
const data = await deleteAddressServices(req.body);
res.send(formatResponse(0, "", data));
});
module.exports = router;