-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (24 loc) · 700 Bytes
/
index.js
File metadata and controls
35 lines (24 loc) · 700 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
33
34
35
import express from 'express';
import routes from './src/routes/crmRoutes';
import mongoose from 'mongoose';
import bodyParser from 'body-parser';
const app=express();
const PORT =4000;
// mongoose connection
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost/CRMdb',{
useNewUrlParser: true,
useUnifiedTopology:true
});
// bodyparser setup
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
routes(app);
//serving static files
app.use(express.static('public'))
app.get('/',(req,res) =>
res.send(`Node and express server running on port ${PORT}`)
);
app.listen(PORT,()=>
console.log(`Your server is running on port ${PORT}`)
);