forked from maniksharma98144/Linking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
39 lines (31 loc) · 893 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
36
37
38
39
const express = require('express');
const mongoose = require('mongoose');
const cors = require('cors');
const compression = require('compression');
const keys = require('./config/keys');
require('./models/user');
require('./models/place');
require('./models/location');
require('./models/conversation');
require('./models/chat');
require('./models/block');
mongoose.connect(keys.mongoURI, {
useNewUrlParser: true,
useCreateIndex: true,
useUnifiedTopology: true,
});
const PORT = process.env.PORT || 80;
const api = require('./api');
const app = express();
app.use(cors());
app.use(compression());
app.use(express.json());
app.use(express.urlencoded({
extended: false
}));
app.use('/api', api);
const server = app.listen(PORT, () => {
console.log(`Server running on at http://localhost:${PORT}`);
});
const io = require('socket.io')(server);
require('./socket')(io);