---
title: Go net/http
description: "Serve a Go http.Handler with Tako's listener, authenticated status endpoint, bootstrap secrets, and native build configuration for deployment."
---

## Search

Page index: https://tako.sh/llms.txt. Docs and blog posts also have .md URLs.

This site has a search endpoint: https://context7.com/api/v2/ask?siteKey=ask_b8918f0414955bb91bfa1a89&query=<URL-encoded question>. It returns documentation that answers the question, with a source link for each part. No API key is needed. If nothing matches, it says so.


The root Go module is `tako.sh`. Its `ListenAndServe` accepts any `http.Handler`, including the standard library router and [Gin](/docs/gin/), [Echo](/docs/echo/), or [Chi](/docs/chi/) routers.

## Connect the handler

```bash
go get tako.sh
```

```go main.go
package main

import (
    "fmt"
    "log"
    "net/http"

    "tako.sh"
)

func main() {
    mux := http.NewServeMux()
    mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintln(w, "Hello from Tako")
    })
    if err := tako.ListenAndServe(mux); err != nil {
        log.Fatal(err)
    }
}
```

Tako owns the listening address, readiness signal, authenticated internal `/status`, and graceful shutdown. For a custom server loop use `tako.Listener()` and retain internal status handling; see the [Go SDK skill](https://tako.sh/.well-known/agent-skills/tako-sdk-go/SKILL.md).

## Configure and verify

```toml tako.toml
name = "go-app"
runtime = "go"
main = "app"

[build]
run = "CGO_ENABLED=0 go build -o app ."

[envs.production]
route = "go.example.com"
servers = ["prod"]
```

Use the CGO setting appropriate to your dependencies. Build for the selected server's OS/architecture; copying a macOS binary does not produce a Linux release. See [Deployment](/docs/deployment/) for build/artifact behavior and [Docker](/docs/docker/) for server-side image builds.

Run `go test ./...`, start `tako dev --background --json`, and request the returned HTTPS URL. Set private values with [Secrets](/docs/secrets/) and run `tako generate` for typed Go accessors. [Presence](/docs/presence/) and [Stores](/docs/stores/) have Go backend registrations consumed by the shared browser clients.

Source example: [examples/go/basic](https://github.com/tako-sh/tako/tree/master/examples/go/basic).
