-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
28 lines (21 loc) · 895 Bytes
/
server.js
File metadata and controls
28 lines (21 loc) · 895 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
var express = require('express');
var dotenv = require('dotenv');
var SpotifyApp = require('./lib/spotify-app.js');
var app = express();
var cookieParser = require('cookie-parser');
dotenv.load();
app.use(cookieParser('test'));
var port = process.env.PORT || '8081';
var clientId = process.env.CLIENT_ID;
var clientSecret = process.env.CLIENT_SECRET;
var router = express.Router();
var spotifyApp = new SpotifyApp(clientId, clientSecret);
router.get('/auth', spotifyApp.authenticate.bind(spotifyApp));
router.get('/scrape', spotifyApp.scrape.bind(spotifyApp));
router.get('/coverify', spotifyApp.coverify.bind(spotifyApp));
router.get('/supafy', spotifyApp.supafy.bind(spotifyApp));
router.get('/playlists', spotifyApp.playlists.bind(spotifyApp));
app.use('/', router);
app.listen(port);
console.log('Magic happens on port ' + port);
exports = module.exports = app;