-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (23 loc) · 1.03 KB
/
index.js
File metadata and controls
32 lines (23 loc) · 1.03 KB
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
const config = require('./config/config.js');
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const passport = require('passport');
const mongoose = require('mongoose');
const mongoURI = global.gConfig.mongoURI;
const app = express();
app.use(bodyParser.json());
app.use(cors());
app.use(passport.initialize());
require('./config/passport')(passport);
const users = require('./routes/api/users');
const jobs = require('./routes/api/jobs');
app.use('/api/user', users);
app.use('/api/job', jobs);
mongoose.connect(mongoURI, { useNewUrlParser: true, useUnifiedTopology: true })
.then(response => { console.log('MongoDB has been connected...') })
.catch(error => { console.log(error, 'MongoDB error conncetion...') });
const port = process.env.PORT || 5001;
// module.exports = app.listen(port, () => console.log(`Server started on port http://localhost:${port}`));
app.listen(port, () => console.log(`Server started on port http://localhost:${port}`));
module.exports = app;