Hello,
I'm learning how to host web applications on Vercel and I've been trying to make a template project using Express and Typescript as a beginning foundation. I've placed all of my code inside of a src folder, with an api directory containing the server entry point index.ts. I'm using tsup to compile my typescript code into javascript code in the dist folder.
For my project settings on Vercel, I have the "Install Command" set to npm install --include=dev (since I need typescript and tsup to build), the "Build Command" set to npm run build, and the "Output Directory" set to ./dist. No "Development Command" and no "Root Directory" overrides.
For my vercel.json file, I have a "rewrite" with the key/value pairs "source": "/(.*)" and "destination": "/api" to redirect all traffic to the server entrypoint.
The deploy is successful, but on navigating to the endpoint express-typescript-vercel-template.vercel.app, the compiled javascript code is displayed instead of the root GET result defined in my Express application. Looking at the "Deployment Summary", the "Static Files" does have an /api/index.js file, but it's not detecting any frameworks unfortunately, so I've definitely went wrong somewhere.
Any help on what mistake I've made or improvements to the project structure would be greatly appreciated.
Github repo: 0mn1core/express-typescript-vercel-template