neutral/routes/index.js

18 lines
334 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 {
res.render('index');
}
});
module.exports = router;