-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathserver.js
More file actions
31 lines (21 loc) · 789 Bytes
/
server.js
File metadata and controls
31 lines (21 loc) · 789 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
'use strict';
const express = require('express');
const app = express();
const mongoose = require('mongoose');
const bodyParser = require('body-parser').json();
const spotifyAuthRouter = require('./route/spotify-auth-routes');
const playlistRouter = require('./route/manage-playlist-routes');
const userAuth = require('./route/user-routes');
const dbPort = process.env.MONGODB_URI || 'mongodb://localhost/dev_db';
mongoose.connect(dbPort);
app.use(express.static(__dirname + '/public'));
app.use(bodyParser);
app.use('/', userAuth);
app.use('/', spotifyAuthRouter);
app.use('/', playlistRouter);
app.use('*', (req, res) => {
res.status(404).json({Message:'Not Found'});
});
app.listen(process.env.PORT || 8888, () => {
console.log('Up on ' + (process.env.PORT || 8888));
});