Stacks
Go
Deploy a Go web app built from go.mod.
What we detect
A go.mod makes it a Go app. We build it with go build and run the binary. The default port is 8080.
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Hello from DockHosting") })
http.ListenAndServe("0.0.0.0:"+port, nil)
}Several commands in one repository
If your main package isn't at the root (for example cmd/server), set the build and start commands in Settings, or deploy with a Dockerfile.
Database
Read DATABASE_URL: pgx, database/sql drivers and GORM all take a connection URL.
