var express = require('express'); var router = express.Router(); const user_controller = require("../controllers/userController"); const StringUtils = require("../utils/StringUtil"); /* GET home page. */ router.get('/', function (req, res, next) { res.render('index', { title: 'Express' }); }); router.get('/user', async function (req, res, next) { let us = await user_controller.user_list(); us = JSON.stringify(us); res.send(us); }) router.post('/login', async function (req, res, next) { let us = await user_controller.user_list(); const body = JSON.parse(JSON.stringify(req.body)); if (StringUtils.isNotEmpty(body)) { if (body.account === '' || body.account === undefined || body.account === null) { res.send('account is null'); } if (body.password === '' || body.password === undefined || body.password === null) { res.send('password is null'); } } res.send('return ok'); }); module.exports = router;