ORM models added

This commit is contained in:
newtbot
2023-12-17 18:31:17 +08:00
parent ca0d24248c
commit 33adf3f1d9
4 changed files with 95 additions and 11 deletions

View File

@ -7,7 +7,6 @@ const app = express();
const PORT = process.env.PORT || 3000;
require('dotenv').config()
// MySQL setup (replace with your MySQL connection details)
const mysqlConfig = {
host: process.env.host,
user: process.env.user,
@ -38,7 +37,7 @@ function isAuthenticated(req, res, next) {
app.post('/login', (req, res) => {
let { username, password } = req.body;
// Trim leading and trailing spaces from username
// Trim whitespace
username = username.trim();
// Validate username and password against MySQL