This is an example of what i'm trying to achieve... I'm wondering if there is something like this in sveltekit without creating a separate file to handle the "GET_2" endpoint.
// +server.ts
export const GET: RequestHandler = async () => {
// ...stuff
};
export const GET_2: RequestHandler = async () => {
// ...stuff
};
To my knowledge that is not possible, the +server
documentation merely states that for each HTTP method of GET
, POST
, PATCH
, PUT
and DELETE
a handler can be exported.
You could work around that by using query parameters and then delegating to corresponding functions in the file.