When i run it locally, it’s good
But after deployment on vercel, it’s giving a 404 error (Not Found). I have checked everything, my env variables are good, my api keys are good, actually everything is good, even the request to server is sent, the problem is from server. Please help vercel staff, new to backend…
Thanks for sharing the repo. That was very helpful to see.
It looks like the project uses Express.js, which needs a bit of adjustment to work in a serverless environment. Files in the /api directory are automatically turned into serverless functions. Files outside of that directory are not automatically used as Vercel Functions unless some extra configuration is done to make it happen.
For most projects, I recommend using the /api folder option. It’s the least fussy solution and it’s what I most often use for my own projects.
This is a pretty quick change to make in your case. First, you would need to create a /api folder and move the index.js file into it. Then update the vercel.json file with the following: