mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
20 lines
361 B
Go
20 lines
361 B
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"net/http"
|
|
|
|
"github.com/syumai/workers"
|
|
)
|
|
|
|
func main() {
|
|
http.HandleFunc("/hello", func(w http.ResponseWriter, req *http.Request) {
|
|
msg := "Hello!"
|
|
w.Write([]byte(msg))
|
|
})
|
|
http.HandleFunc("/echo", func(w http.ResponseWriter, req *http.Request) {
|
|
io.Copy(w, req.Body)
|
|
})
|
|
workers.Serve(nil) // use http.DefaultServeMux
|
|
}
|