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.
canteen/routes/order.js

40 lines
1.1 KiB

const express = require("express")
const router = express.Router()
const {
getOrderServices,
addOrderServices,
updateOrderServices,
deleteOrderServices
} = require("../services/orderService")
const {
formatResponse
} = require("../utils/tools")
router.get("/", async function (req, res, next) {
const data = await getOrderServices()
res.send(formatResponse(0, "", data))
})
router.get("/:userId", async function (req, res, next) {
console.log("getID2", req.params.userId)
const data = await getOrderServices(req.params.userId)
res.send(formatResponse(0, "", data))
})
router.post("/", async function (req, res, next) {
const data = await addOrderServices(req.body)
res.send(formatResponse(0, "", data))
})
// router.put("/", async function (req, res, next) {
// const data = await updateOrderServices(req.body)
// res.send(formatResponse(0, "", data))
// })
// router.delete("/", async function (req, res, next) {
// const data = await deleteOrderServices(req.body)
// res.send(formatResponse(0, "", data))
// })
module.exports = router