🚧 Created simple hello world app

This commit is contained in:
Maxim Lebedev 2023-11-03 22:42:13 +06:00
parent c127dcd6fa
commit 567180570e
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
2 changed files with 26 additions and 0 deletions

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module source.toby3d.me/toby3d/playground
go 1.21.3

23
main.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
srv := http.Server{
Addr: ":3000",
Handler: http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprintln(w, "Hello, World!")
}),
}
log.Println("starting at :3000...")
if err := srv.ListenAndServe(); err != nil {
log.Fatalln("error:", err.Error())
}
log.Println("done!")
}