nrg
(Ni9ht Router Group) is a simple and easy to use router for your web application. It is written in pure Golang and has no dependencies.
- HTTP Methods
- add http handler
- Context
- GetQuery
- PostFrom
- GetBody
- GetHeader
- Get
- JSON
- HTML
- File
- Redirect
- Router
- Add Router
- Static Route
- Parameter Route
- Regex Route
- Group Route
- Middleware
- Installation
go get -u github.com/yni9ht/nrg
- Example
package main
import (
"fmt"
"github.com/yni9ht/nrg"
)
func main() {
server := nrg.NewServer()
server.GET("/ping", func(context *nrg.Context) {
context.JSON(200, "pong")
})
if err := server.Run(); err != nil {
fmt.Printf("error %+v \n", err)
}
}