forked from PaystackHQ/paystack-music-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
35 lines (27 loc) · 971 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
30
31
32
33
34
35
// server.js
// where your node app starts
// init project
const express = require('express');
const bodyParser = require('body-parser');
const helmet = require('helmet');
const app = express();
const path = require('path');
const { app: appConfig } = require('./config');
const logger = require('./helpers/logger');
const indexRouter = require('./routes/index');
const playlistRouter = require('./routes/playlists');
const trackRouter = require('./routes/track');
require('./config/db');
app.use('/public', express.static(path.join(__dirname, 'public')));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(helmet());
app.disable('x-powered-by');
app.use('/', indexRouter);
app.use('/playlists', playlistRouter);
app.use('/track', trackRouter);
// listen for requests :)
const listener = app.listen(appConfig.port, () => {
logger.info(`Your app is listening on port ${listener.address().port}`);
});
module.exports = app;