-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
32 lines (24 loc) · 782 Bytes
/
Copy pathserver.js
File metadata and controls
32 lines (24 loc) · 782 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
32
// Inject dotenv environment
require('dotenv').config();
//Core Library Imports
const http = require('http');
//External Library Imports
const cors = require('cors');
const express = require('express');
const bodyParser = require('body-parser');
const router = require('./router');
//Initializing Express App
var app = express();
//Create Server using http
var server = http.createServer(app);
server.timeout = 30000;
//Registering Middleware
app.use(bodyParser.json({ type: '*/*', limit: '50mb', parameterLimit: 50000 }));
// app.use(morgan('dev'));
app.use(express.static(__dirname + '/public'));
app.use(cors({ origin: "*" }));
router(app);
const port = process.env.PORT || 8081;
server.listen(port, () => {
console.log(`\x1b[1mServer Started at Port: ${port}`);
});