mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
30 lines
638 B
Go
30 lines
638 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/syumai/workers"
|
|
)
|
|
|
|
func main() {
|
|
r := chi.NewRouter()
|
|
r.Route("/api", func(r chi.Router) {
|
|
r.Get("/hello", func(w http.ResponseWriter, req *http.Request) {
|
|
name := req.URL.Query().Get("name")
|
|
if name == "" {
|
|
name = "Pages Functions"
|
|
}
|
|
fmt.Fprintf(w, "Hello, %s!", name)
|
|
})
|
|
r.Get("/hello2", func(w http.ResponseWriter, req *http.Request) {
|
|
fmt.Fprintf(w, "Hello, Hello world!")
|
|
})
|
|
r.Get("/hello3", func(w http.ResponseWriter, req *http.Request) {
|
|
fmt.Fprintf(w, "Hello, Hello, Hello world!")
|
|
})
|
|
})
|
|
workers.Serve(r)
|
|
}
|