netadaptor converts net/http handlers to gearbox ⚙️ handlers
⚙️ gearbox requires version 1.14
or higher of Go (Download Go)
Just use go get to download and install gearbox
go get -u github.com/gogearbox/gearbox
go get u- github.com/gogearbox/netadaptor
package main
import (
"fmt"
"net/http"
"github.com/gogearbox/gearbox"
"github.com/gogearbox/netadaptor"
)
func main() {
// Setup gearbox
gb := gearbox.New()
// Define your handlers
gb.Get("/hello", netadaptor.HTTPHandlerFunc(myHandler))
// Start service
gb.Start(":3000")
}
// http handler function
func myHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello World!")
}