The plugin's documentation specifies that the default allowed methods is basically the * wildcard. However when developing my API with this plugin I encountered CORS issues when trying to call a route using the DELETE method:
import { Elysia } from "elysia";
import { cors } from "@elysiajs/cors";
import * as gql from "./gql";
import * as media from "./media";
new Elysia()
.use(cors())
.group("/api", (app) =>
app
.post("/gql", gql.POST)
.group("/media", (app) =>
app
.get("", media.GET)
.post("", media.POST)
.delete("", media.DELETE), // This one
),
)
.listen(3000);
Fixed it by setting the methods parameter to *:
import { Elysia } from "elysia";
import { cors } from "@elysiajs/cors";
import * as gql from "./gql";
import * as media from "./media";
new Elysia()
.use(cors({ methods: "*" })) // Here
.group("/api", (app) =>
app
.post("/gql", gql.POST)
.group("/media", (app) =>
app
.get("", media.GET)
.post("", media.POST)
.delete("", media.DELETE),
),
)
.listen(3000);
The plugin's documentation specifies that the default allowed methods is basically the
*
wildcard. However when developing my API with this plugin I encountered CORS issues when trying to call a route using the DELETE method:Fixed it by setting the methods parameter to
*
:Not a huge problem but kinda annoying