-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
25 lines (19 loc) · 782 Bytes
/
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
const express = require('express');
const mongoose = require('mongoose');
const bodyParser = require('body-parser');
const passport = require('passport');
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
// MongoDB connected
mongoose.connect('mongodb://localhost:27017/sentimentDB', { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => console.log('MongoDB Connected'))
.catch(err => console.log(err));
// Passport
app.use(passport.initialize());
require('./config/passport')(passport);
// Routes
app.get('/', (req, res) => res.send('Server is running!'));
// Start the server at this port
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));