webgo

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

MIT License

Stars
301
Committers
4
webgo - v6.6.5 Latest Release

Published by bnkamalesh over 2 years ago

[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

webgo - v6.3.1

Published by bnkamalesh over 2 years ago

[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)

webgo - v6.2.2

Published by bnkamalesh about 3 years ago

[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

webgo - v5.3.2

Published by bnkamalesh about 3 years ago

[patch] fixed bug when trailing slash configuration was being ignored when using wildcard in URI
[-] removed some unused constants

webgo - v5.3.1

Published by bnkamalesh about 3 years ago

[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

webgo - v5.2.0

Published by bnkamalesh over 3 years ago

[minor] router.Use method for adding middleware, is now variadic
[minor] 2 new helper methods webgo.SetError(*http.Request, error) & webgo.GetError(r)
[-] refer SetError, GetError for usage details

webgo - v5.0.0

Published by bnkamalesh over 3 years ago

[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

webgo - Fixed a critical routing bug

Published by bnkamalesh over 3 years ago

Fixed a critical issue while creating regex patter for URIs without parameters. It's surprising it was never caught before!

webgo - Minor improvements

Published by bnkamalesh over 3 years ago

[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

webgo - v4.1.3

Published by bnkamalesh over 4 years ago

[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

webgo - v4.0.4

Published by bnkamalesh over 4 years ago

[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
webgo - v4.0.0

Published by bnkamalesh over 4 years ago

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
webgo - v3.5.4

Published by bnkamalesh over 4 years ago

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!

webgo - Minor enhancements

Published by bnkamalesh over 5 years ago

  • Updated middleware to use LOGHANDLER
  • Added tests for router.go -> computePatternStr
  • Updated awesome-go badge link.
webgo - New logging interface

Published by bnkamalesh about 6 years ago

  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
webgo - CORS middleware updates

Published by bnkamalesh about 6 years ago

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

webgo - v2.2.3

Published by bnkamalesh over 6 years ago

All known bugs squashed.
All of the items in the wishlist completed.
Stable release :)

webgo - v2.1.0

Published by bnkamalesh over 6 years ago

Minor semantic changes. Renamed middlewares to middleware. No other major change.

webgo - v2.0.0

Published by bnkamalesh over 6 years ago

  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.

webgo - v1.6.1

Published by bnkamalesh over 6 years ago

Minor improvement in the ServeHTTP function