A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).

Overview

webgo gopher

coverage

WebGo v4.1.3

WebGo is a minimalistic framework for Go to build web applications (server side) with zero 3rd party dependencies. Unlike full-fledged frameworks, it gets out of your way as soon as possible in the execution flow. WebGo has always been and will always be Go standard library compliant; with the HTTP handlers having the same signature as http.HandlerFunc.

Important

  • Regression introduced in v4.0.4, exists on v4.0.6 as well. Requests panic when not using Webgo's response methods (e.g. R200, Send, SendResponse etc.) because the default HTTP status is set as 0

  • ContextPayload.URIParams(*http.Request)map[string]string was replaced despite being newly introduced in v3.5.4. The new function is ContextPayload.Params()map[string]string, and has a slight performance advantage compared to URIParams

Index

  1. Router
  2. Handler chaining
  3. Middleware
  4. Helper functions
  5. HTTPS ready
  6. Graceful shutdown
  7. Logging
  8. Usage

Router

The router is one of the most important component of a web application. It helps identify the HTTP requests and pass them on to respective handlers. A handler is identified using a URI. WebGo supports defining URIs with the following patterns

  1. /api/users
    • Static URI pattern with no variables
  2. /api/users/:userID
    • URI pattern with variable userID (named URI parameter)
    • This will not match /api/users/johndoe/account. It only matches till /api/users/johndoe/
      • If TrailingSlash is set to true, refer to sample
  3. /api/users/:misc*
    • Named URI variable misc
    • This matches everything after /api/users. e.g. /api/users/a/b/c/d

If multiple patterns match the same URI, the first matching handler would be executed. Refer to the sample to see how routes are configured. A WebGo Route is defined as following:

webgo.Route{
	// A name for the API (preferrably unique)
	Name string
	// HTTP verb, i.e. GET, POST, PUT, PATCH, HEAD, DELETE
	Method string
	// The URI pattern
	Pattern string
	// If the URI ends with a '/', should it be considered valid or not? e.g. '/api/users' vs '/api/users/'
	TrailingSlash bool
	// In case of chained handlers, should the execution continue after one of the handlers have 
	// responded to the HTTP request
	FallThroughPostResponse bool
	// The list of HTTP handlers
	Handlers []http.HandlerFunc
}

You can access named parameters of the URI using the Context function.

func helloWorld(w http.ResponseWriter, r *http.Request) {
	// WebGo context
	wctx := webgo.Context(r)
	// URI paramaters, map[string]string
	params := wctx.Params()
	// route, the webgo.Route which is executing this request
	route := wctx.Route
	webgo.R200(
		w,
		fmt.Sprintf(
			"Route name: '%s', params: '%s'", 
			route.Name,
			params, 
			),
	)
}

Handler chaining

Handler chaining lets you execute multiple handlers for a given route. Execution of a chain can be configured to run even after a handler has written a response to the http request. This is made possible by setting FallThroughPostResponse to true (refer sample).

webgo.Route{
	Name: "chained",
	Method: http.MethodGet,
	Pattern: "/api",
	TrailingSlash: false,
	FallThroughPostResponse: true,
	Handlers []http.HandlerFunc{
		handler1,
		handler2,
		.
		.
		.
	}
}

Middleware

WebGo middleware lets you wrap all the routes with a middleware. Unlike handler chaining, middleware applies to all the handlers. All middleware should be of type Middlware. The router exposes a method Use && UseOnSpecialHandlers to add a Middleware to the router. Following code shows how a middleware can be used in WebGo.

import (
	"github.com/bnkamalesh/webgo/v4"
	"github.com/bnkamalesh/webgo/v4/middleware"
)

func routes() []*webgo.Route {
	return []*webgo.Route{
		&webo.Route{
			Name: "home",
			Method: http.http.MethodGet,
			Pattern: "/",
			Handlers: []http.HandlerFunc{
				func(w http.ResponseWriter, r *http.Request) {
					webgo.R200(w, "home")
				}
			},
		},
	}
}

func main() {
	router := webgo.NewRouter(*webgo.Config{
		Host:         "",
		Port:         "8080",
		ReadTimeout:  15 * time.Second,
		WriteTimeout: 60 * time.Second,
	}, routes())

	router.UseOnSpecialHandlers(middleware.AccessLog)
	
	router.Use(middleware.AccessLog)

	router.Start()
}

Any number of middleware can be added to the router, the order of execution of middleware would be LIFO (Last In First Out). i.e. in case of the following code

func main() {
	router.Use(middleware.AccessLog)
	router.Use(middleware.CorsWrap())
}

CorsWrap would be executed first, followed by AccessLog.

Helper functions

WebGo provides a few helper functions.

  1. ResponseStatus(w http.ResponseWriter) get the HTTP status code from response writer
  2. SendHeader(w http.ResponseWriter, rCode int) - Send only an HTTP response header with the provided response code.
  3. Send(w http.ResponseWriter, contentType string, data interface{}, rCode int) - Send any response as is, with the provided content type and response code
  4. SendResponse(w http.ResponseWriter, data interface{}, rCode int) - Send a JSON response wrapped in WebGo's default response struct.
  5. SendError(w http.ResponseWriter, data interface{}, rCode int) - Send a JSON response wrapped in WebGo's default error response struct
  6. Render(w http.ResponseWriter, data interface{}, rCode int, tpl *template.Template) - Render renders a Go template, with the provided data & response code.

Few more helper functions are available, you can check them here.

When using Send or SendResponse, the response is wrapped in WebGo's response struct and is serialized as JSON.

{
	"data": "<any valid JSON payload>",
	"status": "<HTTP status code, of type integer>"
}

When using SendError, the response is wrapped in WebGo's error response struct and is serialzied as JSON.

{
	"errors": "<any valid JSON payload>",
	"status": "<HTTP status code, of type integer>"
}

HTTPS ready

HTTPS server can be started easily, by providing the key & cert file. You can also have both HTTP & HTTPS servers running side by side.

Start HTTPS server

cfg := &webgo.Config{
	Port: "80",
	HTTPSPort: "443",
	CertFile: "/path/to/certfile",
	KeyFile: "/path/to/keyfile",
}
router := webgo.NewRouter(cfg, routes())
router.StartHTTPS()

Starting both HTTP & HTTPS server

cfg := &webgo.Config{
	Port: "80",
	HTTPSPort: "443",
	CertFile: "/path/to/certfile",
	KeyFile: "/path/to/keyfile",
}

router := webgo.NewRouter(cfg, routes())
go router.StartHTTPS()
router.Start()

Graceful shutdown

Graceful shutdown lets you shutdown the server without affecting any live connections/clients connected to the server. It will complete executing all the active/live requests before shutting down.

Sample code to show how to use shutdown

func main() {
	osSig := make(chan os.Signal, 5)

	cfg := &webgo.Config{
		Host:            "",
		Port:            "8080",
		ReadTimeout:     15 * time.Second,
		WriteTimeout:    60 * time.Second,
		ShutdownTimeout: 15 * time.Second,
	}
	router := webgo.NewRouter(cfg, routes())

	go func() {
		<-osSig
		// Initiate HTTP server shutdown
		err := router.Shutdown()
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		} else {
			fmt.Println("shutdown complete")
			os.Exit(0)
		}

		// If you have HTTPS server running, you can use the following code
		// err := router.ShutdownHTTPS()
		// if err != nil {
		// 	fmt.Println(err)
		// 	os.Exit(1)
		// } else {
		// 	fmt.Println("shutdown complete")
		// 	os.Exit(0)
		// }
	}()

	signal.Notify(osSig, os.Interrupt, syscall.SIGTERM)

	router.Start()

	for {
		// Prevent main thread from exiting, and wait for shutdown to complete
		time.Sleep(time.Second * 1)
	}
}

Logging

WebGo exposes a singleton & global scoped logger variable LOGHANDLER with which you can plugin your custom logger. Any custom logger should implement WebGo's Logger interface.

type Logger interface {
    Debug(data ...interface{})
    Info(data ...interface{})
    Warn(data ...interface{})
    Error(data ...interface{})
    Fatal(data ...interface{})
}

Configuring the default Logger

The default logger uses Go standard library's log.Logger with os.Stdout (for debug and info logs) & os.Stderr (for warning, error, fatal) as default io.Writers. You can set the io.Writer as well as disable specific types of logs using the GlobalLoggerConfig(stdout, stderr, cfgs...) function.

GlobalLoggerConfig(nil, nil, LogCfgDisableDebug, LogCfgDisableInfo...)

Usage is shown in cmd/main.go.

Usage

A fully functional sample is provided here. You can try the following API calls with the sample app.

  1. http://localhost:8080/
    • Route with no named parameters configured
  2. http://localhost:8080/matchall/
  3. `http://localhost:8080/api/

How to run the sample

If you have Go installed on your system, open your terminal and:

$ cd $GOPATH/src
$ mkdir -p github.com/bnkamalesh
$ cd github.com/bnkamalesh
$ git clone https://github.com/bnkamalesh/webgo.git
$ cd webgo
$ go run cmd/main.go

Info 2020/06/03 12:55:26 HTTP server, listening on :8080

Or if you have Docker, open your terminal and:

$ git clone https://github.com/bnkamalesh/webgo.git
$ cd webgo
$ docker run \
-p 8080:8080 \
-v ${PWD}:/go/src/github.com/bnkamalesh/webgo/ \
-w /go/src/github.com/bnkamalesh/webgo/cmd \
--rm -ti golang:latest go run main.go

Info 2020/06/03 12:55:26 HTTP server, listening on :8080

Contributing

Refer here to find out details about making a contribution

Credits

Thanks to all the contributors

The gopher

The gopher used here was created using Gopherize.me. WebGo stays out of developers' way, so sitback and enjoy a cup of coffee like this gopher.

Comments
  • feat: HTTP cache implementation.

    feat: HTTP cache implementation.

    Is your feature request related to a problem? Please describe. An HTTP cache system would be great in webgo to avoid the execution of unchanged response.

    Describe the solution you'd like I can implement Souin as the HTTP cache middleware. With that it will support the CDN validation/invalidation too, set default cache-control header, store in a distributed system using olric or in memory with badger.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context It's already available as Træfik/Tyk plugin, skipper/gin/echo middleware, and is used in the official caddy cache-handler.

    Cheers ✌️

    enhancement 
    opened by darkweak 2
  • #7 fixed bug of HTTP response status code

    #7 fixed bug of HTTP response status code

    Thank you for your feedback! Considering the content of the feedback, i fixed again, so please review. I modified to send status code at the timing to execute Write method.

    opened by hlts2 2
  • Context handling type name is confusing

    Context handling type name is confusing

    Hi

    https://godoc.org/github.com/bnkamalesh/webgo#WC name is confusing. For that reason, comment on the type documents only the meaning of WC shortcut. Please consider renaming it for the next major release

    opened by kirillDanshin 2
  • Invalid response HTTP status

    Invalid response HTTP status

    file: responses.go

    When responses are send using SendResponse or SendError, in case of a JSON encoding error within these functions, the following happens:

    w.WriteHeader(rCode) // Write header is already called here, this cannot be overwritten if err := json.NewEncoder(w).Encode(&dOutput{data, rCode}); err != nil { Log.Println(err) R500(w, ErrInternalServer) // HTTP response status set by this function will not work }

    So the response in such cases would look like this: HTTP Status: 200 { errors: "Internal server error occurred", status: 500 }

    bug 
    opened by bnkamalesh 2
  • [major] NewRouter function now accepts optional Routes instead of sli…

    [major] NewRouter function now accepts optional Routes instead of sli…

    …ce of Routes

    [minor] Router now has a convenience method Add(routes...*Route) [minor] Route grouping feature added (usage available in the sample app, cmd/main.go) [-] updated tests

    opened by bnkamalesh 1
  • Route example in readme gives error: errors.go:54: Unsupported HTTP request method provided.

    Route example in readme gives error: errors.go:54: Unsupported HTTP request method provided.

    Hello. This code in the readme:

    import (
    	"github.com/bnkamalesh/webgo"
    	"github.com/bnkamalesh/webgo/middleware"
    )
    
    func routes() []*webgo.Route {
    	return []*webgo.Route{
    		&webo.Route{
    			Name: "home",
    			Pattern: "/",
    			Handlers: []http.HandlerFunc{
    				func(w http.ResponseWriter, r *http.Request) {
    					webgo.R200(w, "home")
    				}
    			},
    		},
    	}
    }
    
    func main() {
    	router := webgo.NewRouter(*webgo.Config, routes())
    
    	router.UseOnSpecialHandlers(middleware.AccessLog)
    	
    	router.Use(middleware.AccessLog)
    
    	router.Start()
    }
    

    Doesn't work. You need to define a Method field in the Route struct. Also it complains about *webgo.Config not being an expression (unless it was intentional as a placeholder for any pointer to Config). This works:

    func routes() []*webgo.Route {
    	return []*webgo.Route{
    		&webo.Route{
    			Name: "home",
    			Method: "GET",	
    			Pattern: "/",
    			Handlers: []http.HandlerFunc{
    				func(w http.ResponseWriter, r *http.Request) {
    					webgo.R200(w, "home")
    				}
    			},
    		},
    	}
    }
    
    func main() {
    	config := webgo.Config{
    		Host: "localhost",
    		Port: "8888",
    	}
    	router := webgo.NewRouter(&config, routes())
    
    	router.UseOnSpecialHandlers(middleware.AccessLog)
    	
    	router.Use(middleware.AccessLog)
    
    	router.Start()
    }
    
    opened by masoudd 1
  • CORS middleware update

    CORS middleware update

    CORS middleware provided with the package currently responds with a wildcard *. It should be updated to accept a list of domains, and default to wildcard if no domains provided.

    • [x] All CORS middleware functions should accept an optional list of domains
    • [ ] Do not break backward compatibility / New functions if cannot maitnain backward compatibility
    enhancement help wanted 
    opened by bnkamalesh 1
  • fixed readme and type

    fixed readme and type

    I fixed REAMD.md and typo.

    By the following modification, it becomes 15ns when Timeout: 15 was set. 4351cfa6e17120f16dae4f5e2b5fc63186461cda

    Duration: https://golang.org/pkg/time/#Duration

    opened by hlts2 1
  • #7 fixed bug of HTTP response status code

    #7 fixed bug of HTTP response status code

    I fixed bug of issues#7. I changed from Encode function to Marshal. Because Encode function writes the JSON encoding of argument to the stream, but Marshal does JSON encoding only. Therefore, if encoding fails, errors can be picked up.

    Encode: https://golang.org/pkg/encoding/json/#Encoder.Encode Marshal: https://golang.org/pkg/encoding/json/#Marshal

    opened by hlts2 1
  • Support to choose the logging interface

    Support to choose the logging interface

    By default the logs are printed to stdout. Though, there should be a provision of providing an output of users' choice. Need to update the logging mechanism to use an interface, so that it can be set to a thirdparty/external logger

    • [x] Convert current logs to use an interface
    • [ ] Expose a method to replace the logging interface on the fly (should be concurrency safe)
    enhancement help wanted 
    opened by bnkamalesh 1
  • spelling error

    spelling error

    Hello,

    Thanks for developing this simple framework. As a non-voice developer I can easily lift up with your framework. file word written as fil in errors.go file.

    //C003 Error Code 3 C003 = "App environment provided in config fil Accepted values are production or development"

    -Vasu

    opened by vasukolli 1
  • Convenience methods for adding routes

    Convenience methods for adding routes

    Is your feature request related to a problem? Please describe.

    Adding routes currently requires the developer to prepare a single list of *Route with all the routes defined in one go. This can be split up and made easier for the developer

    Describe the solution you'd like

    We can add convenience method for each type of HTTP method supported by webgo (). e.g.

    router.Add(*Route)
    router.Get("URI",[]Handlers{}, opts...)
    router.Head("URI",[]Handlers{}, opts...)
    router.Post("URI",[]Handlers{}, opts...)
    router.Put("URI",[]Handlers{}, opts...)
    router.Patch("URI",[]Handlers{}, opts...)
    router.Delete("URI",[]Handlers{}, opts...)
    router.Option("URI",[]Handlers{},opts...)
    

    Each method should keep updating routes of the router, for the respective HTTP method.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    enhancement help wanted good first issue 
    opened by bnkamalesh 0
  • Login Auth solutions.

    Login Auth solutions.

    Is your feature request related to a problem? Please describe. I wanted to get some examples of how to add login authentication. I have some ideas myself, but curious what the world has in mind.

    Describe the solution you'd like I would like to see examples for: Firebase auth 3rd party Auth perhaps some JWT and or cookie solutions

    wishlist 
    opened by vinceyoumans 1
  • Auto HTTPS with Letsencrypt

    Auto HTTPS with Letsencrypt

    If autoTLS is enabled, it should do the following:

    • [ ] Check if there's a certificate path provided, if not, default to a path
    • [ ] Inject acme routes for Letsencrypt verification
    • [ ] Accept list of domains to provide HTTPS
    • [ ] Check expiry of all generated Letsencrypt certificates
    • [ ] Update certificates automatically N days prior to expiry
    enhancement help wanted 
    opened by bnkamalesh 0
Releases(v6.6.5)
  • v6.6.5(Jun 16, 2022)

    [patch] fixed bug in URI match/params [patch] better URI matching, reduced allocations [patch] resources are released even in case of panic (deferred) [-] added benchmark [-] minor changes to the sample SSE implementation (refactored to use serviceworker) [-] updated SSE README for clarity [patch] refactored SSE for more capabilities of customizing [-] improved reattempting of SSE reconnection, in the sample app [patch] added hooks for create and remove clients from SSE active clients list [-] removed os.ReadFile usage to make the sample app compatible with Go 1.13 [-] setting correct heading size for Server-Sent Eevents

    [minor] added new Broadcast method to sse extension for easily broadcasting a message to all active clients (#40) [-] updated sample app for making things prettier [-] updated the JS in sample app to be modular, cleaner [-] updated documentation and some cosmetic changes to the sample app

    [minor] added helper method to get count of active clients [patch] renamed GetClientMessageChan to ClientMessageChan [-] updated the sample app's HTML page to show details slightly better [-] breaking change in function name, since previous version was released only 24hrs ago. I considered it ok to break it this soon

    [minor] Added a new extension for handling Server Sent Events (SSE) [-] The example app shows how to use this

    Source code(tar.gz)
    Source code(zip)
  • v6.3.1(Feb 10, 2022)

    [minor] URI patterns now support multiple wildcards, you can form more patterns. e.g. all routes ending with /hello [-] Refer to the test TestWildcardMadness in router_test.go to see sample usage [patch] Fixed regression introduced while fixing trailing slash config support for wildcard routes in previous release [-] regression was introduced after changing the regex used for route matching. This releases completely removes regex (there's some decent performance improvement, yay! but with slightly more memory consumption)

    Source code(tar.gz)
    Source code(zip)
  • v6.2.2(Oct 16, 2021)

    [major] NewRouter function now accepts variadic Routes instead of slice of Routes (breaking change) [minor] Router now has a convenience method Add(routes...*Route) [minor] Route grouping feature added (usage available in the sample app, cmd/main.go) [-] updated tests [-] fixed module version in go.mod [-] fixed v6 imports [patch] fixed middleware not applied on routegroups

    Source code(tar.gz)
    Source code(zip)
  • v5.3.2(Sep 7, 2021)

  • v5.3.1(Aug 9, 2021)

    [minor] added a new helper function to get the original HTTP response writer from Webgo's custom response writer [patch] remove check when response is already written, prevent writing any further [-] the blocking behaviour was breaking large responses like files and such

    Source code(tar.gz)
    Source code(zip)
  • v5.2.0(Jun 30, 2021)

  • v5.0.0(Feb 14, 2021)

    [major] Removed deprecated & dead code [-] Render404 was removed. This can be easily replaced using Render function [-] middleware package was removed. There are now sub packages for individual middleware functions, middleware/cors, middleware/accesslogs [-] cleaned up all unit tests [-] updated travis config to use correct version in tests [-] updated minimum test version of Go to 1.13 to support errors.Is

    Source code(tar.gz)
    Source code(zip)
  • v4.1.10(Feb 13, 2021)

  • v4.1.9(Feb 13, 2021)

    [patch] refactored router.Serve method to avoid context payload injection to special handlers [patch] removed deadcode Route.matchAndGet [patch] fixed panic when using CORS middleware with nil configuration [patch] using response writer from pool for chained handlers instead of creating a new instance [patch] other small refactor for cleaner/easy to understand code [patch] removed unused field from context payload

    Source code(tar.gz)
    Source code(zip)
  • v4.1.3(Jul 14, 2020)

    [minor] added webgo.ResponseStatus(rw http.ResponseWriter) int which returns response status code [patch] fixed a bug which did not send appropriate JSON response header for the convenience methods [patch] fixed accesslog middleware not printing valid http status code when not using webgo response methods [patch] fixed regression introduced in 4.0.4, where default http status was 0, now it's set to 200 [patch] refactored accesslog & CORS middleware (moved to new package) [patch] refactored global logger for improved modularity [patch] Removed unnecessary WriteHeader from SendResponse, SendError. Added relevant header write for Send [-] added handler which directly writes using w.Write where 'w' is the http.ResponseWriter, in cmd/main.go [-] added tests for logger [-] no performance impact with these changes [-] removed the empty deprecation logs function [-] removed unwanted comments from cmd/main.go [-] updated README with correct version number & updated important section highlight the regression [-] updated README with correct version number and updated the sample code [-] updated tests to test if w.Write([]byte) where 'w' is the http.ResponseWriter, works as expected

    Source code(tar.gz)
    Source code(zip)
  • v4.0.4(Jun 6, 2020)

    [patch] added http.CloseNotifier implementation [patch] refactored response writer and context payload usage [patch] removed ineffectual assignments [patch] removed redundant check of customResponseWriter.headerWritten [-] fixed typos in comments [-] refactored for better readability at multiple places

    [-] MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports), OS: 10.15.5 (19F101), Go 1.14.4 darwin/amd64 [-] benchmark results

            BenchmarkGetNoParams-8            809166              1433 ns/op
            BenchmarkGetWithParams-8          229358              4878 ns/op
            BenchmarkPostWithParams-8         204218              4904 ns/op
    
    Source code(tar.gz)
    Source code(zip)
  • v4.0.0(Jun 4, 2020)

    v4.0.0

    [major] removed deprecations from 3.x [patch] refactored context payload remove unused fields [patch] introduced new Params function for fetching URI parameters [-] regression introduced in 3.5.4, for URI params computing. Was computing escaped values again, when r.URL.EscapedPath() already gives escaped value [-] README updated with new verison number & details [-] releasenotes.md was removed in favour of git tag messages & github releases [-] benchmark results, run on MacbookPro 2019, Catalina 10.15.5 (19F101), 16 GB 2133 MHz LPDDR3, 1.4 GHz Quad-Core Intel Core i5

             BenchmarkGetNoParams-8            741256              1606 ns/op
             BenchmarkGetWithParams-8          223771              5062 ns/op
             BenchmarkPostWithParams-8         220663              5131 ns/op
    
    Source code(tar.gz)
    Source code(zip)
  • v3.5.4(Jun 3, 2020)

    v3.5.4

    Chances since v2.4.1

    v3.5.4, Wed Jun 3 17:32:37 2020 +0530

    [minor] deprecation logs are now printed while initial setup (list available in Readme) [patch] Send,SendResponse,Render methods would log and respond with Internal server error in case of errors while writing response [patch] refactored route.init method to reduce cognitive complexity & to smaller functions [patch] refactored URI matching methods to reduce cognitive complexity, to smaller functions & minor performance improvement [patch] introduced new function ContextPayload.URIParams(*http.Request), deprecated ContextPayload.Params [-] updated contribution.md


    v3.4.2, Wed May 27 00:59:26 2020 +0530

    [minor] refactored serve method to reduce cyclomatic complexity. This provides performance improvement [patch] updated go.mod file to use Go version 1.14 [patch] updated travis config to remove go version from go.mod


    v3.3.3, Wed May 13 17:43:44 2020 +0530

    [patch] added function to allow configuration of default logger


    v3.3.2, Wed May 13 03:18:02 2020 +0530

    [patch] duplicate route name log is made into a "info" log instead of warn [patch] updated README with valid code


    v3.3.0, Tue Jan 28 09:55:41 2020 +0530

    [minor] Implemented http.Hijacker interface


    v3.2.9, Fri Jan 24 18:24:30 2020 +0530

    [patch] updated how middleware is used on NotFound & NotImplemented handlers


    v3.2.8, Fri Jan 24 16:57:25 2020 +0530

    [patch] refactored for better readability [patch] overwriting the actual request instance [patch] added test to check if webgo context is avaialble in middleware


    v3.2.5, Fri Jan 24 16:42:04 2020 +0530

    [patch] updated ServeHTTP to inject webgo context into the request earlier, to make it available to middleware as well


    v3.2.4, Sat Jan 18 18:56:36 2020 +0530

    [patch] removed some variable declaration to avoid memory allocation [patch] updated sample app to show chaining


    v3.2.2, Sat Jan 18 16:41:55 2020 +0530

    [patch] minor updates to tests and sample app


    v3.2.1, Fri Jan 17 19:18:18 2020 +0530

    [minor] middleware will now be excecuted for the router's NotFound handler as well [minor] Method not implemented status is now executed using a handler similar to NotFound [patch] updated responses test to use t.Error instead of Log & Fail


    v3.0.2, Sun Oct 6 00:50:29 2019 +0530

    updated test to use v3


    v3.0.1, Sun Oct 6 00:37:10 2019 +0530

    middleware package updated


    v3.0.0, Sun Oct 6 00:35:15 2019 +0530

    context payload updated


    v2.5.3, Sat Oct 5 22:14:01 2019 +0530

    documentation update


    v2.5.2, Thu Sep 5 10:11:24 2019 +0530

    fixed go.mod


    v2.5.1, Thu Sep 5 10:09:55 2019 +0530

    fixed go.mod v2


    v2.5.0, Wed Jul 3 17:24:26 2019 +0530

    Webgo context is now available inside middleware too!

    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Apr 14, 2019)

  • 2.4.0(Oct 11, 2018)

    1. Updated Logger
      • Added a new logging interface
    2. Updated tests to cover more code
    3. Updated responses to use constants defined in Go's http standard library instead of using integers for respective HTTP response codes
    4. Check error while executing templates and log
    Source code(tar.gz)
    Source code(zip)
  • 2.3.2(Oct 9, 2018)

    Updated Middleware - Backward incompatible updates - CORS middleware functions are updated and now accepts list of supported/allowed domains - The middleware functions will default to "*" if no domains are passed to the functions

    Source code(tar.gz)
    Source code(zip)
  • v2.2.3(Apr 15, 2018)

  • v2.1.0(Apr 2, 2018)

  • v2.0.0(Apr 1, 2018)

    1. Chaining and middleware are different now
    2. Cleaned up code, removed a lot of unnecessary code
    3. Removed certain redundant features (like Globals)
    4. Starting HTTPS server now has a different function router.StartHTTPS

    P.S: This release brought in a few changes which are not backward compatible.

    Source code(tar.gz)
    Source code(zip)
  • v1.6.1(Mar 18, 2018)

  • v1.6.0(Mar 18, 2018)

    v1.6.0

    This version marks the end of 1.x. There will only be bug fixes for this version going forward 1.6.x

    v2.0.0

    1. This version would feature cleaner middleware structure; by wrapping an exposed ServeHTTP method.
      • Will be detailed during release
    2. Chaining and middlewares would be semantically considered different in 2.x unlike in 1.x
    3. Further optimized ServeHttp function

    Removing

    1. Access log per route will be removed instead access will only be configurable for the whole server
    Source code(tar.gz)
    Source code(zip)
  • v1.5.5(Jan 30, 2018)

    v1.5.5

    • Minor updates to code structure
    • Minor formatting changes
    • Added Go tests (refer README on how to run the tests)
    • Added Go benchmark (refer README on how to run the benchmarks)
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Dec 13, 2017)

  • 1.0.1(Aug 2, 2017)

  • v1.0(Mar 29, 2017)

Owner
Kamaleshwar
Let's fix this planet, one line of code at a time.
Kamaleshwar
Gin middleware/handler to enable CORS support.

wcors Gin middleware/handler to enable CORS support. Usage Start using it Download and install it: go get github.com/wyy-go/wcors Import it in your co

null 0 Jan 8, 2022
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Flamingo 343 Jan 5, 2023
This library provides a simple framework of microservice, which includes a configurator, a logger, metrics, and of course the handler

Microservice The framework for the creation of microservices, written in Golang. (note: http microservice) Architecture microservice includes: handle

Eduard 109 Dec 30, 2022
Go-app is a package to build progressive web apps with Go programming language and WebAssembly.

Go-app is a package to build progressive web apps with Go programming language and WebAssembly.

Maxence Charriere 6.7k Dec 30, 2022
Timeout handler for http request in Gin framework

Middleware to Handle Request Timeout in Gin Installation Installation go get github.com/s-wijaya/gin-timeout Import it in your code: import ( // o

Saptari Wijaya 0 Dec 14, 2021
🚀‏‏‎ ‎‏‏‎‏‏‎‎‎‎‎‎Copper is a Go toolkit complete with everything you need to build web apps.

Copper Copper is a Go toolkit complete with everything you need to build web apps. It focuses on developer productivity and makes building web apps in

Copper 891 Jan 7, 2023
Muxie is a modern, fast and light HTTP multiplexer for Go. Fully compatible with the http.Handler interface. Written for everyone.

Muxie ?? ?? ?? ?? ?? ?? Fast trie implementation designed from scratch specifically for HTTP A small and light router for creating sturdy backend Go a

Gerasimos (Makis) Maropoulos 280 Dec 8, 2022
Web framework for creating apps using Go in Google AppEngine

Welcome to app.go v3.0 app.go is a simple web framework for use in Google AppEngine. Just copy the app folder to your working folder and import it fro

George Nava 46 Mar 21, 2021
Goa is a web framework based on middleware, like koa.js.

Goa Goa is under construction, if you are familiar with koa or go and interested in this project, please join us. What is goa? goa = go + koa Just lik

null 47 Sep 27, 2022
Golanger Web Framework is a lightweight framework for writing web applications in Go.

/* Copyright 2013 Golanger.com. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except

golanger 298 Nov 14, 2022
The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework.

jin About The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework. If thi

null 8 Jul 14, 2022
hiboot is a high performance web and cli application framework with dependency injection support

Hiboot - web/cli application framework About Hiboot is a cloud native web and cli application framework written in Go. Hiboot is not trying to reinven

hidevops.io 179 Nov 20, 2022
based on go lang build WEB development framework for go lang beginners .

based on go lang build WEB development framework for go lang beginners .

zhenfan.yu 1 Oct 31, 2021
Bootstrapper and middleware for Echo framework in golang.

rk-echo Interceptor & bootstrapper designed for echo framework. Currently, supports bellow functionalities. Name Description Start with YAML Start ser

PointGoal 5 Jul 9, 2022
A framework for apps written entirely in YAML, powered by ytt.

yapp A framework for apps written entirely in YAML, powered by ytt. Highly experimental! Do not use! # start the server... go run . -f examples/hello-

Reid Mitchell 4 May 6, 2022
Roche is a Code Generator and Web Framework, makes web development super concise with Go, CleanArch

It is still under development, so please do not use it. We plan to release v.1.0.0 in the summer. roche is a web framework optimized for microservice

Riita 14 Sep 19, 2022
A powerful go web framework for highly scalable and resource efficient web application

webfr A powerful go web framework for highly scalable and resource efficient web application Installation: go get -u github.com/krishpranav/webfr Exa

Krisna Pranav 13 Nov 28, 2021
A powerful go web framework for highly scalable and resource efficient web application

A powerful go web framework for highly scalable and resource efficient web application

null 22 Oct 3, 2022