-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
39 lines (33 loc) · 1.2 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
import express from 'express';
import bodyParser from 'body-parser';
import cors from 'cors';
const app=express();
var mongoose=require('mongoose');
mongoose.connect('mongodb://localhost:27017/project', { useNewUrlParser: true },function(error){
if(error) console.log(error);
});
var auth=require('./routes/auth');
var product=require('./routes/product');
var productcatalogue=require('./routes/productcatalogue');
var salesrep=require('./routes/token');
var customer=require('./routes/customer');
var productenquiry=require('./routes/productenquiry');
var order=require('./routes/order');
var report=require('./routes/report');
var admindashboard=require('./routes/admindashboard');
app.use(cors())
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));
app.use('/api/sales',auth);
app.use('/api/product',product);
app.use('/api/productops',productcatalogue);
app.use('/api/token',salesrep);
app.use('/api/customer',customer);
app.use('/api/productenquiry',productenquiry);
app.use('/api/order',order);
app.use('/api/report',report);
app.use('/api/admindashboard',admindashboard);
const PORT=5000
app.listen(PORT,()=>{
console.log(`Server running at ${PORT}`)
})