Pending
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { Request, Response } from "express";
|
||||
|
||||
export function login_post(req: Request, res: Response) {
|
||||
export function signup_post(req: Request, res: Response) {
|
||||
res.send("logged in");
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ const router = Router();
|
||||
|
||||
//const mws = [requireAuth, handleValidation.handleValidationError];
|
||||
|
||||
router.post("/login", authController.login_post);
|
||||
router.post("/signup", authController.signup_post);
|
||||
|
||||
//router.post(
|
||||
// "/login",
|
||||
|
48
api/src/utils/test_mariadb.ts
Normal file
48
api/src/utils/test_mariadb.ts
Normal file
@ -0,0 +1,48 @@
|
||||
import { Sequelize } from 'sequelize';
|
||||
|
||||
let sequelize: Sequelize | null = null;
|
||||
|
||||
const connectDB = async () => {
|
||||
sequelize = new Sequelize({
|
||||
dialect: 'mariadb',
|
||||
host: 'localhost',
|
||||
username: 'your_username',
|
||||
password: 'your_password',
|
||||
database: 'your_database',
|
||||
});
|
||||
|
||||
try {
|
||||
await sequelize.authenticate();
|
||||
console.log('Connection to the database has been established successfully.');
|
||||
} catch (error) {
|
||||
console.error('Unable to connect to the database:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const dropDB = async () => {
|
||||
if (sequelize) {
|
||||
try {
|
||||
await sequelize.drop();
|
||||
console.log('Database dropped successfully.');
|
||||
} catch (error) {
|
||||
console.error('Error dropping database:', error);
|
||||
} finally {
|
||||
await sequelize.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const dropTables = async () => {
|
||||
if (sequelize) {
|
||||
try {
|
||||
await sequelize.sync({ force: true });
|
||||
console.log('All tables dropped successfully.');
|
||||
} catch (error) {
|
||||
console.error('Error dropping tables:', error);
|
||||
} finally {
|
||||
await sequelize.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export { connectDB, dropDB, dropTables };
|
Reference in New Issue
Block a user