-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
26 lines (23 loc) · 866 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
const express = require("express");
const dotenv = require("dotenv");
const morgan = require("morgan");
const bodyParser = require("body-parser");
const connectDB = require("./server/database/connection")
const YoutubeService = require("./server/services/YoutubeService")
const path = require('path');
const app = express();
const PORT = process.env.PORT || 8080
setAppEnv();
YoutubeService.callYoutubeDataApi();
function setAppEnv() {
dotenv.config({path:'config.env'})
connectDB();
app.use(morgan('tiny'));
app.use(bodyParser.urlencoded({ extended: true }));
app.set('port', PORT);
app.set("view engine", "ejs");
app.set("views", path.join(__dirname, 'views'));
app.use('/', require('./server/routes/router'));
app.listen(PORT, () => { console.log('Server is Running on http://localhost:' + PORT); });
}
module.exports = app;