solid-start
solid-start copied to clipboard
API routes have to be inline exported function declarations
Describe the bug
This works
export async function GET(...parameters) {
console.log(parameters);
return new Response("test", { status: 200 });
};
while this doesn't
const GET = async (...parameters) => {
console.log(parameters);
return new Response("test", { status: 200 });
};
export { GET };
Your Example Website or App
n/a
Steps to Reproduce the Bug or Issue
- Create the second code example as an API route.
- Observe it responding with this
{
"statusCode": 500,
"stack": []
}
Expected behavior
It should just work like the first code example. Internally, this library probably uses function names instead of named export names to determine the endpoint functions. It shouldn't.
Screenshots or Videos
No response
Platform
- OS: macOS Sequoia
- Browser: Chrome
- Version: 1.0.6
Additional context
No response