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.
|
|
|
const express = require("express")
|
|
|
|
const router = express.Router()
|
|
|
|
const {
|
|
|
|
getExpressServices,
|
|
|
|
addExpressServices,
|
|
|
|
updateExpressServices,
|
|
|
|
deleteExpressServices
|
|
|
|
} = require("../services/expressService")
|
|
|
|
const {
|
|
|
|
formatResponse
|
|
|
|
} = require("../utils/tools")
|
|
|
|
|
|
|
|
router.get("/", async function (req, res, next) {
|
|
|
|
const data = await getExpressServices()
|
|
|
|
res.send(formatResponse(0, "", data))
|
|
|
|
})
|
|
|
|
|
|
|
|
router.post("/", async function (req, res, next) {
|
|
|
|
const data = await addExpressServices(req.body)
|
|
|
|
res.send(formatResponse(0, "", data))
|
|
|
|
})
|
|
|
|
|
|
|
|
router.put("/", async function (req, res, next) {
|
|
|
|
const data = await updateExpressServices(req.body)
|
|
|
|
res.send(formatResponse(0, "", data))
|
|
|
|
})
|
|
|
|
|
|
|
|
router.delete("/", async function (req, res, next) {
|
|
|
|
const data = await deleteExpressServices(req.body)
|
|
|
|
res.send(formatResponse(0, "", data))
|
|
|
|
})
|
|
|
|
|
|
|
|
module.exports = router
|