-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
26 lines (21 loc) · 842 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
var config = require('./src/config');
if (config.missingRequiredConfig()) {
console.log('Missing required configuration. Please be sure the config.json file exists and is valid.');
process.exit(1);
}
var express = require('express'),
app = express(),
router = express.Router(),
controller = require('./src/controller');
app.engine('html', require('ejs').renderFile);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use('/static', express.static(__dirname + '/static'));
app.use('/', router);
router.get('/', function(req, res) {
res.render('index.html');
});
router.get('/login-spotify', controller.loginOnSpotify);
router.get('/handle-spotify-response', controller.handleSpotifyResponse);
app.listen(8899, 'localhost');
console.log('Server started. Listening on http://localhost:8899');