Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #9 from joemphilips/allow_cors
Browse files Browse the repository at this point in the history
Use `cors` to allow request from any origin.
  • Loading branch information
grunch authored Aug 30, 2023
2 parents 6a75de7 + 9dcf395 commit 9b258e8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
42 changes: 42 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@types/cors": "^2.8.13",
"@types/express": "^4.17.15",
"@types/jest": "^29.2.4",
"@types/morgan": "^1.9.3",
Expand All @@ -41,6 +42,7 @@
"typescript": "^4.9.4"
},
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"express-http-context": "^1.2.4",
Expand Down
4 changes: 4 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import cors from "cors";
import express from "express";
import httpContext from "express-http-context";
import morgan from "morgan";
Expand All @@ -15,6 +16,9 @@ const app = express();
// Create app directory if it doesn't exist
setDir(path.join(homedir(), APP_DIR));

// Allow request from any origin
app.use(cors());

app.use(httpContext.middleware);

// Set the Id to be used in the logs
Expand Down

0 comments on commit 9b258e8

Please sign in to comment.