text: const express = require('express');
  const sql = require('../util/sql');
  const router = express.Router();
  const CI = require('../util/commonInfo')
  
  /* 登陆页面 GET*/
  router.get('/', function (req, res, next) {
      res.render('login', {title: CI.loginTitle});
  });
  
  /* 登陆页面 POST验证*/
  router.post('/', function (req, res) {
  
      let data = {
          name: req.body.name,
          password: req.body.password,
      }
  
      /**
       * 账户判断
       * @OK : 密码正确
       * @FAIL : 密码错误
       */
      sql.managerCheck(data.name, (queryRes) => {
          if (queryRes.password === data.password) {
              res.cookie("username", data.name, {maxAge: 9000000, httpOnly: true}); //cookie
              res.end('OK');
          } else res.end('FAIL')
      })
  })
  
  
  module.exports = router;
  