-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (29 loc) · 936 Bytes
/
Copy pathindex.js
File metadata and controls
37 lines (29 loc) · 936 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
33
34
35
36
37
/** ------------------ IMPORTING PACKAGE ------------------ **/
const express = require('express');
const port = 8000;
const app = express();
const path = require('path');
const expressLayouts = require('express-ejs-layouts');
const csv = require('csv-parser');
const db = require("./config/mongoose");
const bodyParser = require('body-parser');
// setting layouts
app.use(expressLayouts);
// middleware for body-parser
app.use(bodyParser.json());
app.use(express.urlencoded({extended: true}));
//accesing static files from assets folder
app.use(express.static('./assets'));
//setting up view engine
app.set("view engine", "ejs");
app.set("views", "./views");
// setting up routes
app.use('/', require('./routes'));
// directing the app in the given port
app.listen(port, function(err) {
if(err) {
console.log('Error', err);
return;
}
console.log('Server is up and running on port: ', port);
});