Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

Zero-configuration Go backend support - Vercel

Vercel News·Ricardo Gonzalez·4 days ago
#sRgUTzXl
#vercel#port#backends#addr#photo#audio
Reading 0:00
15s threshold

Go API backends can now be deployed on Vercel with zero-configuration deployment.

package main

import (

"fmt"

"net/http"

"os"

)

func main() {

port := os.Getenv("PORT")

if port == "" {

port = "3000"

}

http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {

fmt.Fprintf(w, "Hello World")

})

addr := ":" + port

fmt.Printf("Listening on %s\n", addr)

http.ListenAndServe(addr, nil)

}

Vercel now recognizes Go servers as first-class backends and automatically provisions the right resources and configures your application without redirects in vercel.json or the /api folder convention.

Backends on Vercel use Fluid compute with Active CPU pricing by default. Your Go API scales automatically with traffic, and you pay only for active CPU time rather than idle capacity.

Read More