Gem
Gem, a simple and fast web framework, it built top of fasthttp.
Install
go get github.com/go-gem/gem
Features
- Graceful shutdown and restart
- Leveled logging
- High-performance and pretty router, very friendly to RESTful APIs
- Sessions support
- Various Middlewares
- JSON WEB TOKEN middleware
- Compress middleware
- Basic Auth middleware
- Request Body Limit middleware
- CSRF middleware
- CORS middleware
- Not bad scores of test coverage - 85%~100% is acceptable.
Performance
Parameter | Info |
---|---|
Date | 2016-11-01 |
Go Version | 1.7.1 |
OS | Ubuntu 16.04.1 LTS |
CPU | Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz 8 Cores |
Memory | 8G |
The benchmark comes from my laptop, I have send a pull request to go-web-framework-benchmark, waiting for merging and rerunning the benchmark.
Quick Start
package main
import (
"log"
"github.com/go-gem/gem"
)
func main() {
log.Fatal(gem.ListenAndServe(":8080", func(ctx *gem.Context) {
ctx.HTML(200, "Hello world.")
}))
}
Run the code above, and then navigate to 127.0.0.1:8080.
Wiki
Examples
Semantic Versioning
Gem follows semantic versioning 2.0.0 managed through GitHub releases.
Support Us
⭐ the project.- Spread the word.
- Contribute to the project.
Contribute
- Report issues
- Send PRs.
- Improve/fix documentation.
We’re always looking for help, so if you would like to contribute, we’d love to have you!
Motivation
Just for figuring out the web framework's workflow, and try to design a simple and strong web framework.
Related Packages
- tests - a tests package for fasthttp and Gem.
- sessions - a sessions manager package for fasthttp.
- log - a simple, leveled logging package.
FAQ
-
What should I pay attention to?
At present, Gem is incompatible with some APIs of fasthttp, the incompatible APIs following:
- fasthttp.TimeoutHandler
-
What is the difference between of fasthttp and gem?
Gem built on top of fasthttp, and use
Server.ServeConn
to serve connections, it can not works without fasthttp.Advantages:
Gem provides some useful built-in features, such as:
- High-performance router
- Leveled logger
- Various middlewares
- Sessions support
- Graceful shutdown and restart
Disadvantages:
At present, Gem dose not provide APIs to Serve the custom
Listener
likefasthttp.Serve
.
LICENSE
MIT licensed. See LICENSE file for more information.
Inspiration & Credits
I have read the code of the following open source projects, and integrate their designs into this project.
I respect these projects and it's authors, and follow their LICENSE.
If your LICENSE is missing, please contact me, I will add it ASAP.