feat: add CORS support with user-sourced trusted origins from .env
All checks were successful
Update changelog / changelog (push) Successful in 24s
All checks were successful
Update changelog / changelog (push) Successful in 24s
This commit is contained in:
@@ -3,10 +3,11 @@ dotenv.config({ quiet: true });
|
||||
|
||||
import express from 'express';
|
||||
import { version } from '../package.json';
|
||||
import miscRouter from './routes/miscRoutes';
|
||||
import userRouter from './routes/userRoutes';
|
||||
import { AppDataSource } from './data-source'
|
||||
import inferUser from './middleware/inferUser';
|
||||
import miscRouter from './routes/miscRoutes';
|
||||
import userRouter from './routes/userRoutes';
|
||||
import { getCorsConfig } from './tools/cors';
|
||||
|
||||
AppDataSource.initialize().then(async () => {
|
||||
|
||||
@@ -15,6 +16,7 @@ AppDataSource.initialize().then(async () => {
|
||||
const app: express.Express = express();
|
||||
|
||||
app.use(express.json());
|
||||
app.use(getCorsConfig());
|
||||
app.use(inferUser);
|
||||
app.use(miscRouter, userRouter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user