-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
29 lines (23 loc) · 832 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
require('dotenv').config();
const express = require('express');
const bodyParser = require('body-parser');
const passport = require('passport');
const users = require('./routes/api/users');
const geocoding = require('./routes/api/geocoding');
const timezone = require('./routes/api/timezone');
// Setup express
const PORT = process.env.PORT || 3000;
const app = express();
// Setup body-parser middleware
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
// Setup passport middleware
app.use(passport.initialize());
// Passport config
require('./config/passport.js')(passport);
// User routes
app.use('/api/users', users);
app.use('/api/geocoding', geocoding);
app.use('/api/timezone', timezone);
// Start the express server
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));