I'm currently trying to deploy a TypeScript Hapi.js server to Vercel and facing difficulties with the deployment. I've tried following some express with TypeScript deployment tutorials, since I couldn't find any with Hapi.js. I ended writing this in my vercel.json:
{
"version": 2,
"builds": [
{
"src": "dist/src/index.js",
"use": "@vercel/node",
"config": { "includeFiles": ["dist/src/**"] }
}
],
"routes": [
{
"src": "/(.*)",
"dest": "dist/src/index.js"
}
]
}
And this doesn't work. I've tried to change the src to just / but it only worked for the base route and not other routes.
Here is the Github repo, if anyone wants to look at it. Thanks for any help in advance!
I ended up adding
methodsfield to the vercel.json routes array and the deployment worked!I found this configuration on this blog and by the looks of it, it should work on other typescript based backend server that you want to deploy on vercel.