composable, open minded and light weight mvc library. Inspired dropwizard and utron. Usese
fasthttp by default but can also switch to standard net/http in the future.
- Offer a set of reusable libraries similar to excellent
gorillalibraries. - Designed to be 12factor compliant from the ground up
- Both server and router are zero memory allocation and byte slice optimised
- No lock in and non intrusive. Freely compatible with any
fasthttp.RequestHandlerbased code or Middleware - Not opinionated about how you structure your business logic
For a while I looked for a light weight go mvc library that was intuitive to use like Rails and dropwizard. The closest match I found was utron, which was impressive. But still suffers the same lock-in symptoms as more heavy weight web frameworks such as iris, gin or echo. Having an wrapper layer of utron.Ctx, iris.Context, gin.Context or echo.Context adds an extra layer of custom vendor complexity and straight away throws out any standard net/http or fasthttp compatible middlewares.
I wrote gofury to be a "library and not a "framework". It offers some opinions but does not enforce them. All libraries and interfaces can be replaced with alternatives to suit developer needs. Helpful but with zero lock-in.
func main() {
app := gofury.BaseApplication{}
// load configuration
cfg := &gofury.HTTPConfig{}
app.LoadConfig(cfg)
// register services
app.RegisterServices(createFastHTTPService(cfg, &log.Logger{}), createQueueService())
// start up application
app.StartUp()
// shudown cleanly when application exits
defer app.ShutDown()
}
GoFury out of the box forms a composition glue between the following libraries:
- fasthttp zero mem alloc http server, sensible
RequestCtxthat is easy to use and test - fasthttprouter zero mem alloc router
- fusion middleware chaining inspired by alice
- envconfig environment variable based config
- apex/log simple, handler based structured logging
- glide for depedency management that makes sense
Testing is made easier with:
- testify assertions and mocks
- httpexpect http testing library with
fasthttpsupport
Other options libraries:
- fastjsonapi jsonapi conversion using
fasthttpandeasyjson - easyjson fastest non-reflection struct based json parsing
make test
See examples/example_test.go
- db migration
- metrics and healthcheck
- standard net/http module