26 lines
473 B
JavaScript
26 lines
473 B
JavaScript
var express = require('express');
|
|
var router = express.Router();
|
|
var auth = require("../bin/auth")
|
|
|
|
/* GET home page. */
|
|
router.get('/', function(req, res, next) {
|
|
|
|
if(!auth.check(req.cookies.token)) {
|
|
res.clearCookie('token')
|
|
res.redirect(302, "/login")
|
|
} else {
|
|
|
|
if(process.env.DEV ) {
|
|
|
|
res.render('index', {dev: "<p class='view-item yellow'>DÉVELOPEMENT</p>"});
|
|
} else {
|
|
|
|
res.render('index', {dev: ""});
|
|
}
|
|
|
|
|
|
}
|
|
});
|
|
|
|
module.exports = router;
|