Svelte Sapper Server Route 404 Not Found

Viewed 326

I am using default Sapper sveltejs/sapper-template#webpack to start my project

I have a server route called auth/login that only accept POST request from the same Sapper client script.

The file structure looks like this:

enter image description here

And the Server route auth/login looks like this:

enter image description here

But I got a 404 Not Found error, and it even just run under npm run dev only:

enter image description here

I don't understand what is exactly the problem, can anyone please help?

Thank you very much in advance.

1 Answers

After researching on this problem. I found that in server route auth/login the code missed async.

So this is wrong:

export function post(req, res, next){}

This is correct.

export async function post(req, res, next){}

And it works after I change it.

Related