Skip to content

l1ttps/routix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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

  1. 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"
      },
    ),
  )
}
  1. 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")

}
  1. Run go run main.go and open http://localhost:3000

About

πŸš€ Routing X is a Golang library for routing REST APIs πŸš€

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages