Skip to content

NuxtJS, /api route always return 404 #4030

Answered by styfle
arhakim asked this question in General
Discussion options

You must be logged in to vote

Hi @arhakim

You don't need {"src": "/api", "dest": "/api/index.js"} because that is how routing already works. If an index file is found in the directory then it will be served. Visiting these paths will all serve the same function:

  • /api
  • /api/index
  • /api/index.js

I would recommending converting your Express app to proper Serverless Functions by following this Guide: https://zeit.co/guides/migrate-to-zeit-now#serverful-vs.-serverless-apis

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by arhakim
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
Labels
None yet
2 participants