Skip to content

Commit 6aceeda

Browse files
authored
feat: add cors
1 parent 682bdb3 commit 6aceeda

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

backend/config/cors.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { defineConfig } from "@adonisjs/cors";
22

3+
import env from "#start/env";
4+
35
/**
46
* Configuration options to tweak the CORS policy. The following
57
* options are documented on the official documentation website.
@@ -8,7 +10,7 @@ import { defineConfig } from "@adonisjs/cors";
810
*/
911
const corsConfig = defineConfig({
1012
enabled: true,
11-
origin: true,
13+
origin: env.get("CORS_ORIGIN", "planer.solvro.pl").split(","), // ["http://localhost:3000", "http://localhost:8080"]
1214
methods: ["GET", "HEAD", "POST", "PUT", "DELETE"],
1315
headers: true,
1416
exposeHeaders: [],

0 commit comments

Comments
 (0)