-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
35 lines (28 loc) · 833 Bytes
/
server.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
28
29
30
31
32
33
34
35
const express = require('express')
const app = express()
const cors = require('cors')
const connectDatabase = require('./config/database')
const userRouter = require('./routes/user')
const productRouter = require('./routes/product')
const cartRouter = require('./routes/cart')
const webhookRouter = require('./routes/webhook')
app.use(express.json());
var corsOptions = {
origin: '*'
};
app.use(cors(corsOptions));
app.use('/api/v1/',[userRouter, productRouter, cartRouter, webhookRouter]);
app.get('/', (req, res)=>{
res.status(200).json({
"status":true,
"message":{
"title":"Ecommerce API",
"dev":"@seyiadel [Twitter, Github]",
"versions": 1
}
})
})
const port = 3000
app.listen(port, ()=>{
console.log(`Server is running on localhost:${port}`);
})