-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
27 lines (21 loc) · 795 Bytes
/
app.js
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
require("dotenv").config();
const express = require("express");
const app = express();
const cors = require("cors");
const bodyParser = require('body-parser');
const jsonParser = bodyParser.json();
const orderRoute = require("./src/modules/orders/orderRoute");
const productRoute = require("./src/modules/products/productRoute");
const userRoute = require("./src/modules/users/userRoute");
app.use(cors());
app.get('/', (req, res) => res.status(200).json({
success: 1,
message: 'This is the home page',
}));
app.use('/api/order', jsonParser, orderRoute);
app.use('/api/product', jsonParser, productRoute);
app.use('/api/user', jsonParser, userRoute);
const port = process.env.APP_PORT || 8081;
app.listen(port, () => {
console.log("Server up and running on port : ", port);
});