Skip to content

Commit

Permalink
comment out other defs of cors and configure it in app
Browse files Browse the repository at this point in the history
  • Loading branch information
rugglcon committed Aug 23, 2019
1 parent 48796ea commit 80b3e52
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class App {
}

config(): void {
this.app.use(cors());
this.app.use(cors({ origin: true, credentials: true }));
this.app.use((_req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
Expand Down
2 changes: 1 addition & 1 deletion src/routes/budget.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ExpenseLogic } from 'logic/expenses';
export const budgetRoutes = (cors: () => RequestHandler, budgetLogic: BudgetLogic, expenseLogic: ExpenseLogic): Router => {
const budgetsRouter = Router();

budgetsRouter.options('*', cors());
// budgetsRouter.all('*', cors());

// validates that id is a number
budgetsRouter.param('id', (_req, res, next, id) => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/expense.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const expenseRoutes = (cors: () => RequestHandler,
}
});

expensesRouter.options('*', cors());
// expensesRouter.all('*', cors());

// creates an expense
expensesRouter.post('/', async (req, res) => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/user.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const userRoutes = (cors: () => RequestHandler, passport: PassportStatic,
}
});

userRouter.options('*', cors());
// userRouter.all('*', cors({ origin: true, credentials: true }));

// logs a user in
userRouter.post(
Expand Down

0 comments on commit 80b3e52

Please sign in to comment.