2023-07-24 20:27:36 +00:00
|
|
|
require('dotenv').config();
|
|
|
|
import express, { NextFunction, Request, Response } from 'express';
|
|
|
|
import config from 'config';
|
|
|
|
import cors from 'cors';
|
|
|
|
import { AppDataSource } from './db/data-source';
|
2023-07-24 23:15:27 +00:00
|
|
|
import AppError from './errors/appError';
|
2023-07-24 20:27:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppDataSource.initialize()
|
|
|
|
.then(async () => {
|
|
|
|
|
|
|
|
const app = express();
|
|
|
|
|
|
|
|
app.all('*', (req: Request, res: Response, next: NextFunction) => {
|
|
|
|
next(new AppError(404, `Route ${req.originalUrl} not found`));
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|