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.
27 lines
712 B
27 lines
712 B
1 day ago
|
const express = require("express")
|
||
|
const router = express.Router()
|
||
|
const {
|
||
|
getExpressServices,
|
||
|
addExpressServices,
|
||
|
updateExpressServices
|
||
|
} = 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))
|
||
|
})
|
||
|
|
||
|
module.exports = router
|