Skip to content

"405 Method Not Allowed" Error when trying to make a POST request to my "/url" endpoint hosted on Vercel #3911

Closed Locked Answered by TooTallNate
L1xus asked this question in Help
Discussion options

You must be logged in to vote

You should put the index.js file in the api directory instead. That will make it be executed as a Node.js function. Putting it at the root-level like you are doing now will make it be a static file.

In your client-side code, you can invoke the endpoint at POST /api (index is implied as the default). So there is no need for the rewrite in vercel.json.

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@L1xus
Comment options

@KickButtowski80
Comment options

@sigmarsson
Comment options

@sigmarsson
Comment options

@watsonwebdesign
Comment options

Answer selected by amyegan
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment