Skip to content

Commit

Permalink
Remove options thing. Remove cors middleware (all requests are same o…
Browse files Browse the repository at this point in the history
…rigin).
  • Loading branch information
js0mmer committed Dec 19, 2023
1 parent cb56aa3 commit 850d930
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 62 deletions.
48 changes: 0 additions & 48 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"cheerio": "^1.0.0-rc.10",
"connect-mongodb-session": "^3.1.1",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"dayjs": "^1.11.7",
"dotenv-flow": "^3.2.0",
"express": "^4.17.1",
Expand All @@ -28,7 +27,6 @@
"devDependencies": {
"@types/connect-mongodb-session": "^2.4.2",
"@types/cookie-parser": "^1.4.2",
"@types/cors": "^2.8.12",
"@types/dotenv-flow": "^3.2.0",
"@types/express": "^4.17.13",
"@types/express-session": "^1.17.4",
Expand Down
13 changes: 1 addition & 12 deletions api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import cookieParser from 'cookie-parser';
import passport from 'passport';
import session from 'express-session';
import MongoDBStore from 'connect-mongodb-session';
import cors from 'cors';
import dotenv from 'dotenv-flow';
import serverlessExpress from '@vendia/serverless-express';
// load env
Expand Down Expand Up @@ -70,16 +69,10 @@ if (process.env.MONGO_URL) {
app.use(express.json());
app.use(logger('dev'));
app.use(cookieParser());

// Enable CORS
app.use(function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', '*');
res.header('Access-Control-Allow-Headers', '*');
app.use(function (_, res, next) {
res.header('x-powered-by', 'serverless-express');
next();
});
app.use(cors());

/**
* Routes - Public
Expand All @@ -97,10 +90,6 @@ router.use('/roadmap', roadmapRouter);
router.use('/reports', reportsRouter);
app.use('/api', router);

app.options(`*`, (req, res) => {
res.status(200).send();
});

/**
* Error Handler
*/
Expand Down

0 comments on commit 850d930

Please sign in to comment.