code structure improvement
This commit is contained in:
parent
3a5ae2dd7d
commit
5e8ada02f3
12 changed files with 68 additions and 60 deletions
|
@ -2,14 +2,16 @@ const express = require('express');
|
|||
const jwt = require('jsonwebtoken');
|
||||
const sha256 = require("sha256");
|
||||
|
||||
const { getUser } = require("../../../libs/mysql");
|
||||
const { getConnection, getUser } = require("../../../libs/mysql");
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
router.post('/', async (req, res) => {
|
||||
const {username, password} = req.body;
|
||||
|
||||
const user = await getUser(username);
|
||||
const connection = await getConnection();
|
||||
|
||||
const user = await getUser(connection, username);
|
||||
|
||||
if (!user[0]) {
|
||||
return res.status(400).send({error: "wrong login informations"});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue