-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
54 lines (51 loc) · 1.52 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
'use strict'
const express = require('express'),
bodyParser = require('body-parser'),
pug = require('pug'),
restFul = require('method-override')('_method'),
config = require('./config'),
cookieSession = require("cookie-session"),
CuentaRouter = require('./routes/cuenta'),
UsuarioRouter = require('./routes/usuario'),
SolicitudRouter = require('./routes/solicitud'),
CursoRouter = require('./routes/curso'),
InformeRouter = require('./routes/informe'),
session_active = require('./middlewares/session-active'),
app = express()
app
// configuracion app
.set("view engine","pug")
.set('views', config.VIEWS)
.set('port',config.PORT)
// ejecutando middleware
.use( config.PUBLIC, express.static('public') )
// parse application/json
.use( bodyParser.json())
// parse applicaction/x-www-form-urlencoded
.use( bodyParser.urlencoded({extended:false}) )
// para put y delete
.use( restFul )
.use(cookieSession({
name: "session",
keys: ["cursos","ADO"]
}))
// cursos-unison/cuenta
app
.use("/cuenta",CuentaRouter)
// cursos-unison/usuario
app
.use("/usuario",session_active)
.use("/usuario",UsuarioRouter)
// cursos-unison/solicitud
app
.use("/solicitud",session_active)
.use("/solicitud",SolicitudRouter)
// cursos-unison/curso
app
.use("/curso",session_active)
.use("/curso",CursoRouter)
// cursos-unison/informe
app
.use("/informe",session_active)
.use("/informe",InformeRouter)
module.exports = app