-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
71 lines (46 loc) · 1.67 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//Import express package & mongoose package by require
const express = require('express');
const mongoose = require('mongoose');
const cors =require('cors');
//Import expres package & mongoose package by require
//coming to server json format, so convert to js format
const bodyparser = require("body-parser");
const app =express();
//Customer requests
const requestRoutes =require('./routes/requests');
//Customer Inquiries
const inquiryRoutes =require('./routes/inquiries');
//inventory
const inventoryRoutes = require("./routes/inventories");
//production
const productionRoutes = require("./routes/productions");
//qualitycheck
const qcRoutes = require("./routes/qualitycheck");
//transport management
const transportRoutes = require("./routes/transports");
//middleware
app.use(bodyparser.json());
app.use(cors());
//route middleware
app.use(inventoryRoutes);//Inventory
app.use(productionRoutes);//Production
app.use(requestRoutes);//Customer requests
app.use(qcRoutes); //Quality Check
app.use(transportRoutes); // transport management
app.use(inquiryRoutes);//Customer inquiries
// app.use(qcRoutes); //Quality Check
app.use(exportDetails);//Export Details
app.use(buyerRegister);//Buyer Register
//app.use(buyerRegisterRep); //Buyer Register Report
//app.use(exportDetailsRep);
const PORT = 8000;
const DB_URL = 'mongodb+srv://adikt:[email protected]/AdiktExportsDB?retryWrites=true&w=majority';
mongoose.connect(DB_URL)
.then(() => {
console.log('Mongodb Successfully Connected');
})
.catch((err) => console.log('mongodb connection Failed',err));
app.listen(PORT, () =>{
console.log(`App is running on ${PORT}`);
});
module.exports = mongoose;