refactor: streamline SVG handling and improve error messages in user and email controllers
This commit is contained in:
@ -1,32 +1,20 @@
|
||||
// server/app.js
|
||||
console.log("Starting Server...");
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
// import multer from 'multer';
|
||||
// import path from 'path';
|
||||
import db from './models/db.js';
|
||||
import dotenv from 'dotenv';
|
||||
import emailController from "./controllers/emailController.js";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
/**@typedef {import("../client/src/DBRecord.ts").DBRecord} DBRecord */
|
||||
|
||||
console.log("Starting Server...");
|
||||
// test db connection
|
||||
try {
|
||||
await db.query("SELECT 1")
|
||||
console.log("DB connection successful")
|
||||
await db.get('users', {id: 1});
|
||||
console.log("Users table exists");
|
||||
|
||||
await emailController.withTimeout(emailController.transporter.verify(), 15000)
|
||||
.then(() => {
|
||||
console.log("Transporter is ready to send emails");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error verifying transporter:", error);
|
||||
process.exit(1);
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
@ -52,11 +40,11 @@ const upload = multer({storage});*/
|
||||
|
||||
// user routes
|
||||
import userRouter from './controllers/userController.js';
|
||||
|
||||
app.use('/api/users', userRouter);
|
||||
|
||||
// email routes
|
||||
app.use('/api/email', emailController.router);
|
||||
import emailRouter from "./controllers/emailController.js";
|
||||
app.use('/api/email', emailRouter);
|
||||
|
||||
// other routes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user