_index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. const express = require('express');
  2. const { query } = require('express-validator');
  3. const check = require('../../middleware/check');
  4. const router = express.Router();
  5. // /* GET home page. */
  6. // router.get('/', async (req, res) => {
  7. // res.render('index', { title: 'Express' });
  8. // });
  9. // router.get('/test', check([query('id').notEmpty()]), async (req, res) => {
  10. // res.render('index', { title: 'Express' });
  11. // });
  12. router.get('/', async (req, res, next) => {
  13. // if (!req.admin) {
  14. // return res.redirect('/master/login');
  15. // }
  16. const business = req.cookies.token || req.session.business;
  17. // const admin = jwt.decode(token, jwtSecretAdmin);
  18. // if (!business) {
  19. // return res.redirect('/');
  20. // }
  21. res.render('index');
  22. });
  23. // // 登录
  24. // router.get('/login', (req, res) => {
  25. // if (req.business) {
  26. // return res.redirect('/');
  27. // }
  28. // const business = req.cookies.token || req.session.business;
  29. // // const admin = jwt.decode(token, jwtSecretAdmin);
  30. // if (business) {
  31. // return res.redirect('/');
  32. // }
  33. // res.render('index');
  34. // });
  35. module.exports = router;