Skip to content

Commit

Permalink
test again
Browse files Browse the repository at this point in the history
  • Loading branch information
rugglcon committed Aug 27, 2019
1 parent 046f120 commit f8850ff
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ class App {

config(): void {
// this.app.use(cors());
this.app.options('*', cors());
this.app.options('*', cors({
methods: ['POST', 'DELETE', 'GET', 'HEAD', 'OPTIONS'],
credentials: true,
origin: 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 @@ -10,7 +10,7 @@ export const budgetRoutes = (appCors: (options?: cors.CorsOptions | cors.CorsOpt
budgetLogic: BudgetLogic, expenseLogic: ExpenseLogic): Router => {
const budgetsRouter = Router();

budgetsRouter.options('*', appCors({ origin: true, credentials: true }));
// budgetsRouter.options('*', appCors({ origin: true, credentials: true }));

// validates that id is a number
budgetsRouter.param('id', (_req, res, next, id) => {
Expand Down
5 changes: 1 addition & 4 deletions src/routes/expense.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ export const expenseRoutes = (appCors: (options?: cors.CorsOptions | cors.CorsOp
}
});

expensesRouter.options('*', appCors({
origin: true,
credentials: true
}));
// expensesRouter.options('*', appCors({ origin: true, credentials: true }));

// 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 @@ -23,7 +23,7 @@ export const userRoutes = (appCors: (options?: cors.CorsOptions | cors.CorsOptio
}
});

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

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

0 comments on commit f8850ff

Please sign in to comment.