1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-17 17:44:30 +02:00
2020-12-26 15:17:20 +00:00

31 lines
556 B
Go

package main
import (
"fmt"
"log"
"net/http"
"github.com/micro/go-micro/v2/web"
)
func helloWorldHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, `<html><body><h1>Hello World</h1></body></html>`)
}
func main() {
service := web.NewService(
web.Name("go.micro.web.helloworld"),
web.Icon("https://www.thefishsociety.co.uk/media/image/e3/1b/b0/prawn-ix.jpg"),
)
service.HandleFunc("/", helloWorldHandler)
if err := service.Init(); err != nil {
log.Fatal(err)
}
if err := service.Run(); err != nil {
log.Fatal(err)
}
}