neutral/routes/index.js
Raphix 1219e6fecc
All checks were successful
Neutral/pipeline/head This commit looks good
Version 1.1.0 - Revert to app
2024-12-29 15:38:16 +01:00

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;