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

Commit

Permalink
feat: add cors
Browse files Browse the repository at this point in the history
  • Loading branch information
ijsKoud committed Mar 30, 2023
1 parent a53656a commit c26a94a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/server/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { readFileSync } from "node:fs";
import { PrismaClient } from "@prisma/client";
import osUtils from "node-os-utils";
import pidusage from "pidusage";
import cors from "cors";

export default class Server {
public logger: Logger;
Expand Down Expand Up @@ -89,7 +90,7 @@ export default class Server {
dir: join(process.cwd(), "..", "web")
});

this.express.use(cookieParser(), bodyParser.json(), bodyParser.urlencoded({ extended: true }));
this.express.use(cors({ origin: "*" }), cookieParser(), bodyParser.json(), bodyParser.urlencoded({ extended: true }));

await this.api.start();
await this.config.start();
Expand Down
2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@paperplane/ui": "*",
"@paperplane/utils": "*",
"axios": "^1.3.4",
"cors": "^2.8.5",
"file-saver": "^2.0.5",
"formik": "^2.2.9",
"next-seo": "^5.15.0",
Expand All @@ -34,6 +35,7 @@
},
"devDependencies": {
"@babel/core": "^7.21.3",
"@types/cors": "^2.8.13",
"@types/file-saver": "^2.0.5",
"@types/node": "^18.15.11",
"@types/react": "^18.0.31",
Expand Down
25 changes: 23 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,15 @@ __metadata:
languageName: node
linkType: hard

"@types/cors@npm:^2.8.13":
version: 2.8.13
resolution: "@types/cors@npm:2.8.13"
dependencies:
"@types/node": "*"
checksum: 7ef197ea19d2e5bf1313b8416baa6f3fd6dd887fd70191da1f804f557395357dafd8bc8bed0ac60686923406489262a7c8a525b55748f7b2b8afa686700de907
languageName: node
linkType: hard

"@types/cron@npm:^2.0.1":
version: 2.0.1
resolution: "@types/cron@npm:2.0.1"
Expand Down Expand Up @@ -2981,6 +2990,16 @@ __metadata:
languageName: node
linkType: hard

"cors@npm:^2.8.5":
version: 2.8.5
resolution: "cors@npm:2.8.5"
dependencies:
object-assign: ^4
vary: ^1
checksum: ced838404ccd184f61ab4fdc5847035b681c90db7ac17e428f3d81d69e2989d2b680cc254da0e2554f5ed4f8a341820a1ce3d1c16b499f6e2f47a1b9b07b5006
languageName: node
linkType: hard

"cosmiconfig-typescript-loader@npm:^4.0.0":
version: 4.3.0
resolution: "cosmiconfig-typescript-loader@npm:4.3.0"
Expand Down Expand Up @@ -6908,7 +6927,7 @@ __metadata:
languageName: node
linkType: hard

"object-assign@npm:^4.0.1, object-assign@npm:^4.1.1":
"object-assign@npm:^4, object-assign@npm:^4.0.1, object-assign@npm:^4.1.1":
version: 4.1.1
resolution: "object-assign@npm:4.1.1"
checksum: fcc6e4ea8c7fe48abfbb552578b1c53e0d194086e2e6bbbf59e0a536381a292f39943c6e9628af05b5528aa5e3318bb30d6b2e53cadaf5b8fe9e12c4b69af23f
Expand Down Expand Up @@ -9486,7 +9505,7 @@ __metadata:
languageName: node
linkType: hard

"vary@npm:~1.1.2":
"vary@npm:^1, vary@npm:~1.1.2":
version: 1.1.2
resolution: "vary@npm:1.1.2"
checksum: ae0123222c6df65b437669d63dfa8c36cee20a504101b2fcd97b8bf76f91259c17f9f2b4d70a1e3c6bbcee7f51b28392833adb6b2770b23b01abec84e369660b
Expand Down Expand Up @@ -9526,12 +9545,14 @@ __metadata:
"@paperplane/swr": "*"
"@paperplane/ui": "*"
"@paperplane/utils": "*"
"@types/cors": ^2.8.13
"@types/file-saver": ^2.0.5
"@types/node": ^18.15.11
"@types/react": ^18.0.31
"@types/react-dom": ^18.0.11
"@types/react-syntax-highlighter": ^15.5.6
axios: ^1.3.4
cors: ^2.8.5
eslint: 8.37.0
file-saver: ^2.0.5
formik: ^2.2.9
Expand Down

1 comment on commit c26a94a

@ijsKoud
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ijsblokjeee[bot] release v4.1.2

Please sign in to comment.