diff --git a/routes/order.js b/routes/order.js new file mode 100644 index 0000000..bf33e5b --- /dev/null +++ b/routes/order.js @@ -0,0 +1,40 @@ +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 \ No newline at end of file