1
+ import addressRouter from './components/address/address_router' ;
2
+ import authRouter from './components/auth/auth_routes' ;
3
+ import brandRouter from './components/brand/brand_routes' ;
4
+ import cartRouter from './components/cart/cart_routes' ;
5
+ import categoryRouter from './components/category/category_routes' ;
6
+ import couponRouter from './components/coupon/coupon_routes' ;
7
+ import orderRouter from './components/order/order_routes' ;
8
+ import productRouter from './components/products/product_routes' ;
9
+ import reviewRouter from './components/review/review_routes' ;
10
+ import subCategoryRouter from './components/subcategory/subcategory_routes' ;
11
+ import userRouter from './components/user/user_routes' ;
12
+ import wishListRouter from './components/wishlist/wishlist_routes' ;
13
+ import { AppError } from './utils/app_error' ;
14
+ import { globalErrorHandling } from './middleware/global_error_handler' ;
15
+
16
+ export function entrypoint ( app ) {
17
+ app . use ( "/api/v1/categories" , categoryRouter ) ;
18
+ app . use ( "/api/v1/subcategories" , subCategoryRouter ) ;
19
+ app . use ( "/api/v1/brands" , brandRouter ) ;
20
+ app . use ( "/api/v1/products" , productRouter ) ;
21
+ app . use ( "/api/v1/users" , userRouter ) ;
22
+ app . use ( "/api/v1/auth" , authRouter ) ;
23
+ app . use ( "/api/v1/review" , reviewRouter ) ;
24
+ app . use ( "/api/v1/wishlist" , wishListRouter ) ;
25
+ app . use ( "/api/v1/address" , addressRouter ) ;
26
+ app . use ( "/api/v1/coupons" , couponRouter ) ;
27
+ app . use ( "/api/v1/carts" , cartRouter ) ;
28
+ app . use ( "/api/v1/orders" , orderRouter ) ;
29
+
30
+ app . all ( "*" , ( req , res , next ) => {
31
+ next ( new AppError ( "Endpoint was not found" , 404 ) ) ;
32
+ } ) ;
33
+
34
+ app . use ( globalErrorHandling ) ;
35
+ }
0 commit comments