forked from jl4guna/Resume
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
57 lines (43 loc) · 1.38 KB
/
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
var express = require('express.io'),
swig = require('swig'),
_ = require('underscore');
var ex_session = require('express-session');
var server = express();
server.http().io();
var users = [];
//configuracion para renderizar vistas
server.engine('html', swig.renderFile);
server.set('view engine', 'html');
server.set('views', './src/views');
//Cargar archivos staticos
server.use(express.static('./src/assets'));
// Agregamos post. cookies y sessiones
server.configure(function () {
server.use(express.logger());
server.use(express.cookieParser());
server.use(express.bodyParser());
server.use(express.session({
secret : "lolcatz",
cookie : { maxAge : 1200000}
}));
});
//Controllers
var homeController = require('./src/controllers/home');
var resumeController = require('./src/controllers/resume');
var portfolioController = require('./src/controllers/portfolio');
var useController = require('./src/controllers/use');
var contactController = require('./src/controllers/contact');
var postController = require('./src/controllers/post');
homeController(server);
resumeController(server);
portfolioController(server);
useController(server);
contactController(server);
postController(server);
server.io.route('hello?', function (req) {
req.io.emit('saludo',{ //se envia a un usuario
message: 'serverReady'
});
});
var port_number = process.env.PORT || 3000;
server.listen(port_number);