-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] Api routes domain-dependently #53
Comments
update blog, blog category api routes
update: Api routes domain-dependently #53
Thank you for your suggestion! There are instances where the same keyword isn't consistent within a route. For instance, in the server/routes/category.js file, the route for listing categories is /categories, not /category/list. Should I consider changing /categories to /category/list for consistency? router.post("/category", requireSignin, isAdmin, create);
router.put("/category/:categoryId", requireSignin, isAdmin, update);
router.delete("/category/:categoryId", requireSignin, isAdmin, remove);
router.get("/categories", list);
router.get("/category/:slug", read); Regarding the authentication routes (server/routes/auth.js), updating might be a bit challenging due to the variety of keywords used. router.post("/register", register);
router.post("/login", login);
router.put("/profile", requireSignin, updateProfile);
router.get("/auth-check", requireSignin, (req, res) => {
res.json({ ok: true });
});
router.get("/admin-check", requireSignin, isAdmin, (req, res) => {
res.json({ ok: true });
});
router.get("/orders", requireSignin, getOrders);
router.get("/all-orders", requireSignin, isAdmin, allOrders);
router.get("/secret", requireSignin, isAdmin, secret); Furthermore, certain paths (such as product, category, and blog) might be organized, while others aren't. app.use("/api", authRoutes);
app.use("/api/category", categoryRoutes);
app.use("/api/ageCategory", ageCategoryRoutes);
app.use("/api/product", productRoutes);
app.use("/api/blog", blogCategoryRoutes);
app.use("/api/blog", blogPostRoutes);
app.use("/auth", authGoogle);
app.use("/index", indexGoogle); Does this lack of consistency affect the overall cohesiveness of the code? |
@HyangYoung On the second one, I'll grouping them as |
Set api routes domain dependently
YoungleehanKorean/server/index.js
Lines 52 to 58 in 7e913c9
TO-BE
(example)
then you don't need to text 'blogs' or 'products' on every api routes
Comments
The text was updated successfully, but these errors were encountered: