Giter Site home page Giter Site logo

gookit / rux Goto Github PK

View Code? Open in Web Editor NEW
97.0 4.0 16.0 841 KB

⚡ Rux is an simple and fast web framework. support route group, param route binding, middleware, compatible http.Handler interface. 简单且快速的 Go api/web 框架,支持路由分组,路由参数绑定,中间件,兼容 http.Handler 接口

Home Page: https://pkg.go.dev/github.com/gookit/rux?tab=doc

License: MIT License

Go 95.08% Dockerfile 1.26% Makefile 3.47% HTML 0.19%
router http-router go mux http-server http-middleware http-handler middleware

rux's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar dulumao avatar inhere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rux's Issues

Save middleware auth data to *rux.Context

I want to save some data to Context from middleware like below
Middleware.go
func CheckAuth(c *rux.Context) { c.SaveDataForMainController(map[string]string{ "name": "xxxxxxxx", }) c.Next() }

In main controller i want to access data like this
Controller.go
func profile(c *rux.Context) { data := c.getSavedData() }

Is there any way to do like this or can you add features like this

可否考虑引入fasthttp?

大佬您好,我非常喜欢您写的那些工具。我最近看了很多原声net与fasthttp的性能对比的测试结论。想问下这个框架要不要考虑使用呢?感觉fasthttp比较好用的框架还是少...

Sent from PPHub

支持embed文件

前端工程编译到static目录,里面包含html、js等,一般都需要把这些文件做embed,这样携带方便。我看目前所有的StaticXXX接口都不支持此类embed,这个能支持吗?

feat: HTTP cache implementation.

An HTTP cache system would be great in rux to avoid the execution of unchanged response.

I can implement Souin as the HTTP cache middleware. With that it will support the CDN validation/invalidation too, set default cache-control header, store in a distributed system using olric or in memory with badger.

It's already available as Træfik/Tyk plugin, skipper/gin/echo middleware, and is used in the official caddy cache-handler.

Cheers ✌️

StaticFS embed的路径问题

之前提的一个无法embed的问题,测试了下确实可以。但现在遇到一个embed的路径问题。
假设html的目录是static,目录下有index.html和main.js文件

//go:embed static
var embAssets embed.FS

r.StaticFS("/", http.FS(embAssets))

浏览器访问时需要输入:http://127.0.0.1:8080/static/index.html 但index.html中一般引入js的路径是http://127.0.0.1:8080/main.js 导致无法访问。所以希望在StaticFS中,能够把"static"这一层目录处理掉

url with trainling slash /blog/100/ match r.GET(`/blog/{id:\d+}`,

System (please complete the following information):

  • OS: win64
  • GO Version: 1.16
  • Pkg Version: 1.3.2

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

package main

import (
	"github.com/gookit/rux"
)
func main() {
	r := rux.New()
	
	r.GET(`/blog/{id:\d+}`, func(c *rux.Context) {
        c.Text(200, "view detail, id: " + c.Param("id"))
	})
	r.Listen(":8080")
}

Expected behavior
404
A clear and concise description of what you expected to happen.
/blog/100/ not match r.GET(/blog/{id:\d+})

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.