41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
import { Router } from "express";
|
|
import { body, validationResult } from "express-validator";
|
|
import { getProducts, getProductById, createProduct, updateProduct, deleteProduct } from "./handlers/product";
|
|
import { getPosts, getPostById, createPost, updatePost, deletePost } from "./handlers/post";
|
|
import { getUpdates, getUpdateById, createUpdate, updateUpdate, deleteUpdate } from "./handlers/update";
|
|
import { getUpdatePoints, getUpdatePointById, createUpdatePoint, updateUpdatePoint, deleteUpdatePoint } from "./handlers/updatepoint";
|
|
import { validateRequestProduct, validateRequestUpdate, validateRequestUpdatePoint, validateRequestPost } from "./module/validateMiddleware";
|
|
|
|
const router = Router();
|
|
|
|
|
|
router.get("/product", getProducts);
|
|
|
|
|
|
router.get("/product/:id", getProductById);
|
|
|
|
router.post("/product",validateRequestProduct, createProduct);
|
|
router.put("/product/:id",validateRequestProduct,updateProduct);
|
|
router.delete("/product/:id", deleteProduct);
|
|
|
|
router.get("/update", getUpdates);
|
|
router.get("/update/:id", getUpdateById);
|
|
router.post("/update",validateRequestUpdate, createUpdate);
|
|
router.put("/update/:id",validateRequestUpdate, updateUpdate);
|
|
router.delete("/update/:id", deleteUpdate);
|
|
|
|
router.get("/updatepoint", getUpdatePoints);
|
|
router.get("/updatepoint/:id", getUpdatePointById);
|
|
router.post("/updatepoint", validateRequestUpdatePoint, createUpdatePoint);
|
|
router.put("/updatepoint/:id", validateRequestUpdatePoint, updateUpdatePoint);
|
|
router.delete("/updatepoint/:id", deleteUpdatePoint);
|
|
|
|
router.get("/post", getPosts);
|
|
router.get("/post/:id", getPostById);
|
|
router.post("/post", validateRequestPost, createPost);
|
|
router.put("/post/:id", validateRequestPost, updatePost);
|
|
router.delete("/post/:id", deletePost);
|
|
|
|
export default router;
|
|
|