-
Notifications
You must be signed in to change notification settings - Fork 0
/
Portfolio-Server.js
58 lines (41 loc) · 1.5 KB
/
Portfolio-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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//const App = require('./templates/main.jsx');
const express = require('express');
//const ReactEngine = require('express-react-engine');
const bodyParser = require('body-parser');
const http = require('http');
const cookieParser = require('cookie-parser');
const validator = require('express-validator');
const session = require('express-session');
const flash = require('connect-flash');
const path = require('path');
const favicon = require('serve-favicon');
const dependencies = require('./dependencies');
const ejs = require('ejs');
dependencies.resolve(function(home){
const app = SetupExpress();
function SetupExpress(){
const app = express();
const server = http.createServer(app);
server.listen(8080, function(){
console.log('Listening on port 8080');
});
configureExpress(app);
// Setup Router/Routing
const router = require('express-promise-router')();
// grabbing main template
// Grabbing content
home.setRouting(router);
app.use(router);
}
function configureExpress(app){
app.use(express.static('client/public'));
app.use(favicon(path.join(__dirname, '/client/src/img', 'icon.png')));
app.use(cookieParser());
app.set('views', __dirname + '/client/public');
app.set('view engine', 'ejs');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(validator());
app.use(flash());
}
});