Custom API paths
July 09, 2021
1 Min Read

Encore now supports customizing the HTTP path of API raw endpoints. The next release will include complete support for all types of API endpoints.

//encore:api public raw path=/hello/:name
func Greet(w http.ResponseWriter, req *http.Request) {
    name := strings.TrimPrefix(req.URL.Path, "/hello/")
    fmt.Fprintf(w, "Hello, %s!", name)
}