From bf5b813c335c396675404670efa9eabcd73a9ba1 Mon Sep 17 00:00:00 2001 From: fdzcxy212206317 <1909422721@qq.com> Date: Wed, 18 Dec 2024 14:45:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90order=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/order.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 routes/order.js 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