Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
rugglcon committed Aug 27, 2019
1 parent 63d5f00 commit 866dd26
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class App {
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');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,PATCH,HEAD');
next();
});
this.app.use(bodyParser.json());
Expand Down Expand Up @@ -91,28 +92,28 @@ class App {
}

routes(): void {
this.app.options('*', cors({ credentials: true, origin: true }));
// this.app.options('*', cors({ credentials: true, origin: true }));

/**
* BUDGET ROUTES
*/
this.app.use('/api/budgets', cors({ credentials: true, origin: true }), passport.authenticate('jwt', {
this.app.use('/api/budgets', passport.authenticate('jwt', {
session: true
}), budgetRoutes(this.budgetLogic, this.expenseLogic));
logger.info('instantiated budget routes');

/**
* EXPENSE ROUTES
*/
this.app.use('/api/expense', cors({ credentials: true, origin: true }), passport.authenticate('jwt', {
this.app.use('/api/expense', passport.authenticate('jwt', {
session: true
}), expenseRoutes(this.budgetLogic, this.expenseLogic));
logger.info('instantiated expense routes');

/**
* USER ROUTES
*/
this.app.use('/api/user', cors({ credentials: true, origin: true }), userRoutes(passport, this.userLogic, this.authLogic));
this.app.use('/api/user', userRoutes(passport, this.userLogic, this.authLogic));
logger.info('instantiated user routes');
}
}
Expand Down

0 comments on commit 866dd26

Please sign in to comment.