package hello import ( "net/http" "strings" "encore.dev" ) // Landing page with usage instructions. // //encore:api public raw path=/!path func Index(w http.ResponseWriter, req *http.Request) { baseUrl := encore.Meta().APIBaseURL.String() w.Header().Set("Content-Type", "text/html") w.Write([]byte(strings.ReplaceAll(landingPage, "{{baseUrl}}", baseUrl))) } const landingPage = ` Hello World

Hello World Encore.go

A simple REST API to get you started with Encore. This is the simplest possible Encore app, with a single endpoint that returns a greeting.

Explore and test endpoints in the Local Dashboard when running locally. When deployed to Encore Cloud, use the Service Catalog to call endpoints and view traces to see how requests flow between services.

Try it

GET /hello/:name hello.World

Returns a personalized greeting.

curl {{baseUrl}}/hello/World

Next steps

Check out these topics to keep building:

Building a REST API · Defining Services · Using SQL Databases · Using Pub/Sub

`