-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
64 lines (48 loc) · 1.78 KB
/
app.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
58
59
60
61
62
63
64
'use strict'
/**
* Module dependencies.
*/
const express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path')
, db = require('./config')
, bodyParser = require('body-parser')
, socketio = require('socket.io')
, session = require('express-session');
const app = express();
const server = http.createServer(app)
const io = socketio(server)
// CONTROLADORES
const userController = require('./controllers/usuarioController')
const barraController = require('./controllers/barraController')
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.set('view options',{
'layouts':false
})
app.use(express.static(path.join(__dirname, 'public')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }))
app.use(session({secret:'1234',cookie:{}}))
app.get('/', function(req,res) {
res.render("default");
});
// ROUTES
const barraRoute = require('./routes/barra')(io)
const loginRoute = require('./routes/login')
const locatarioRoute = require('./routes/locatario')
app.use('/barra',barraRoute)
app.use('/login',loginRoute)
app.use('/locatario',locatarioRoute)
app.get('/fluid', function(req,res) { res.render("layouts/fluid")});
app.get('/hero', function(req,res) { res.render("layouts/hero")});
app.get('/narrow', function(req,res) { res.render("layouts/marketing-narrow")});
app.get('/signin', function(req,res) { res.render("layouts/signin")});
app.get('/starter', function(req,res) { res.render("layouts/starter-template")});
app.get('/sticky', function(req,res) { res.render("layouts/sticky-footer")});
server.listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});