tests cannot connect to db
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m5s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m5s
This commit is contained in:
24
server.ts
24
server.ts
@@ -125,4 +125,26 @@ app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
|
||||
const PORT = process.env.PORT || 3001;
|
||||
app.listen(PORT, () => {
|
||||
logger.info(`Authentication server started on port ${PORT}`);
|
||||
});
|
||||
});
|
||||
|
||||
// --- START ROUTE DEBUGGING ---
|
||||
// On server startup, print all registered routes to the console.
|
||||
// This helps debug 404s by showing exactly what Express thinks the routes are.
|
||||
const routes: { method: string, path: string }[] = [];
|
||||
app._router.stack.forEach((middleware: any) => {
|
||||
if (middleware.route) { // routes registered directly on the app
|
||||
routes.push({
|
||||
method: Object.keys(middleware.route.methods).join(', ').toUpperCase(),
|
||||
path: middleware.route.path
|
||||
});
|
||||
} else if (middleware.name === 'router') { // router instances
|
||||
middleware.handle.stack.forEach((handler: any) => {
|
||||
const route = handler.route;
|
||||
route && routes.push({ method: Object.keys(route.methods).join(', ').toUpperCase(), path: `${middleware.regexp.source.replace('\\/?(?=\\/|$)', '').slice(1)}${route.path}`});
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log('--- REGISTERED API ROUTES ---');
|
||||
console.table(routes);
|
||||
console.log('-----------------------------');
|
||||
// --- END ROUTE DEBUGGING ---
|
||||
Reference in New Issue
Block a user