# README
RoutiX
š Routing X is a Golang library for routing REST APIs š
Features
- Build for Gin gonic
- Auto grouping routers on instance gin engine
- Auto apply middlewares for global
- Just return any data type from the handler function without using additional functions
- Return HTTP exception filter as JSON status code and message
- Guard
- Interceptor
Installation
go get github.com/l1ttps/routix
go get github.com/gin-gonic/gin
Example of usage
- Create a file app_controler.go
package controller
import (
"github.com/gin-gonic/gin"
"github.com/l1ttps/routix"
)
var (
Controller = routix.Controller
Get = routix.Get
)
func AppController() *gin.Engine {
return Controller("/",
Get("/",
func(c *gin.Context) interface{} {
return "hello world"
},
),
)
}
- Create a file main.go
package main
import (
"github.com/l1ttps/routix"
"<your_pakage>/controller"
)
var (
CreateServer = routix.CreateServer
)
func main() {
CreateServer(routix.ServerConfig{
Controllers: []routix.ControllerType{
controller.AppController,
},
DebugLogger: true,
}).Run(":3000")
}
- Run go run main.go and open http://localhost:3000
# Functions
Controller initializes and configures a new gin.Engine instance for handling HTTP requests.
CreateServer creates a new Gin server with the given configuration.
Delete returns a new RouteBase with the given base path, handler, DELETE method, and optional middlewares.
Get returns a new RouteBase with the given base path, handler function, and optional middlewares.
NewRouteBase creates a new RouteBase struct with the given parameters.
Patch creates a new RouteBase with the specified base path, handler, and middlewares for the PATCH HTTP method.
PipeResponse is a function that takes a handler function as input and returns a gin.HandlerFunc.
Get returns a new RouteBase with the given base path, handler function, and optional middlewares.
Put creates a new RouteBase with the specified base path, handler function, and optional middlewares.
Render generates a gin.HandlerFunc that sets the RENDER context key to the provided path.
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author