I’m using Hono to create a simple api server.
But I want to use /src as my main folder instead of /api.
So, after a lot of searching I found that by using rewrites I can do just that.
But now the problem is that running vercel dev and making a request will download the index.ts file located in my src folder instead of running the requests…
note that using the /api folder worked perfectly so it’s not how I wrote my code.
Hi @werdoxdev. Rewrites are more of a cosmetic change for the display path, which will not accomplish your goal of using /src instead of /api for Functions. You should use the /api directory to deploy Node.js Serverless Functions.
You can create Vercel Function in JavaScript or TypeScript by using the Node.js runtime. By default, the runtime builds and serves any function created within the /api directory of a project to Vercel.
Placing code in the /api directory tells the build process to automatically deploy the code as serverless functions. The Hono starter templates for Vercel and Next.js use the /api directory, so those are good examples to follow. You can find their tutorial here: Vercel - Hono
If you can help me understand why the /src directory is needed for your workflow, I may be able to help you find an alternative approach.