Go runtime
Answered
Harez posted this in #help-forum
HarezOP
Hello everyone. I'm experimenting with the different runtimes that Next.js offers. So far, I've used nodejs (by default) and edge. Now, I'm attempting to use Go, but I'm struggling to find examples of how to do this. The component performs a fetch to /api. In this route, the Go handler is located at app/api/index.go, and this is the function I'm trying:
Could someone guide me a bit?
package handler
import (
"fmt"
"net/http"
)
func Handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello from Go!")
}Could someone guide me a bit?
Answered by riský
you have to use vercel dev on local iirc (not normal next dev) and it just seems like way too much chaos for me to try it
5 Replies
don't think nextjs support go runtime
HarezOP
But Vercel supports the Go runtime for serverless functions just like it does for Node.js and Edge. Isn't Next.js agnostic to the runtime of serverless functions?
https://vercel.com/docs/functions/configuring-functions/runtime
https://vercel.com/docs/functions/configuring-functions/runtime
you have to use vercel dev on local iirc (not normal next dev) and it just seems like way too much chaos for me to try it
Answer
yes vercel (the platform) support go runtime but nextjs is a javascript framework develop by vercel
HarezOP
okay, then doubts cleared, thank you!