-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
32 lines (26 loc) · 900 Bytes
/
app.js
File metadata and controls
32 lines (26 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const express = require('express')
const app = express()
const cors = require('cors')
require('dotenv').config();
// middleware
app.use(cors())
app.use(express.json())
app.use(express.static("public"));
// Define and import routes
const productRoute = require('./src/product/product.routes')
const cartRoute = require('./src/cart/cart.routes')
const userRoute = require('./src/user/user.routes')
const reviewsRoute = require('./src/reviews/reviews.routes')
// Call the setup function from index.js (MongoDB-related routes)
const mongodbRouter = require('./index.js');
app.use('/', mongodbRouter);
// API Route setup
app.use('/api/v1/product', productRoute);
app.use('/api/v1/cart', cartRoute);
app.use('/api/v1/user', userRoute);
app.use('/api/v1/review', reviewsRoute);
// Root Route
app.get('/', (req, res) => {
res.send('The Cake Stand App is working v-1.1 !!');
});
module.exports = app