-
I've created an app with a JS (Node.js) serverless function in /pages/api/seed-data.js. I created a PR and on the Vercel CI server (https://commercial-real-estate-datadeck-jc-git-feature-go-basic.jcald1.vercel.app/), I'm able to access that API route. (/api/seed-data) I also included the Go sample file from https://vercel.com/docs/v2/serverless-functions/supported-languages#go in that same directory. I expected that a call to /api/date to work. However, I'm getting a 404. As a related question, is it possible to test such a serverless endpoint locally? Do I need to run |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thank you for sharing this issue with us! Next.js natively only supports Node.js Serverless Functions. Those are the ones you place in If you want to write Serverless Functions in Node.js and Go, Next.js won't help there, unfortunately. You'd have to place the Serverless Functions inside the And yes, then you'd have to run |
Beta Was this translation helpful? Give feedback.
Thank you for sharing this issue with us!
Next.js natively only supports Node.js Serverless Functions. Those are the ones you place in
pages/api
.If you want to write Serverless Functions in Node.js and Go, Next.js won't help there, unfortunately. You'd have to place the Serverless Functions inside the
api
(notpages/api
) directory, which makes Vercel take care of them.And yes, then you'd have to run
vercel dev
. You can read more about how to use Serverless Functions on Vercel here.