Skip to content

gogearbox/netadaptor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


DeepSource

netadaptor converts net/http handlers to gearbox ⚙️ handlers

Supported Go versions & installation

⚙️ 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

Examples

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!")
}