netadaptor

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 3 Imported by: 0

README


DeepSource

netadaptor converts net/http handlers to gearbox ⚙ handlers

Supported Go versions & installation

⚙ gearbox requires version 1.11 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!")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPHandler

func HTTPHandler(h http.Handler) func(gearbox.Context)

HTTPHandler wraps net/http handler to gearbox handler

func HTTPHandlerFunc

func HTTPHandlerFunc(h http.HandlerFunc) func(gearbox.Context)

HTTPHandlerFunc wraps net/http handler func to gearbox handler

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL