-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
48 lines (38 loc) · 893 Bytes
/
index.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
var express = require('express');
var ejs = require('ejs');
var app = express();
var bodyParser = require('body-parser')
app.set('view engine', 'ejs');
/**
* bodyparser
*/
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
/**
* Static stuff
*/
app.use('/public', express.static('./public'));
console.log('ez egy nagyon regi verzio');
/**
* Let's creat the .tpl and .error on the res object
*/
app.use(function (req, res, next) {
res.tpl = {};
res.tpl.error = [];
return next();
});
/**
* Include all the routes
*/
require('./route/index')(app);
/**
* Standard error handler
app.use(function (err, req, res, next) {
res.status(500).send('Houston, we have a problem!');
//Flush out the stack to the console
console.error(err.stack);
});
*/
var server = app.listen(3000, function () {
console.log('Hello :3000');
});