完善的 Go 路由工具 mux

码农软件 · 软件分类 · 正则表达式工具 · 2019-10-08 23:44:19

软件介绍

mux 是对 http.ServeMux 的扩展,添加正则路由等功能。

相对于 http.ServeMux 提供了以下功能: 

  1. 正则路由;

  2. 自动生成 OPTIONS;

通过与 handlers 还可以实现诸如按域名过滤等功能。

m := mux.NewServerMux(false).
    Get("/user/1", h).              // GET /user/1
    Post("/api/login", h).          // POST /api/login
    Get("/blog/post/{id:\\d+}", h). // GET /blog/post/{id:\d+} 正则路由
    Options("/user/1", "GET")       // OPTIONS /user/1 手动指定该路由项的 OPTIONS 请求方法返回内容

// 统一前缀名称的路由
p := m.Prefix("/api")
p.Get("/logout", h) // 相当于m.Get("/api/logout", h)
p.Post("/login", h) // 相当于m.Get("/api/login", h)

http.ListenAndServe("8080", m)

安装

go get github.com/issue9/mux

本文地址:https://codercto.com/soft/d/16347.html

Essential ActionScript 3.0

Essential ActionScript 3.0

Colin Moock / Adobe Dev Library / June 22, 2007 / $34.64

ActionScript 3.0 is a huge upgrade to Flash's programming language. The enhancements to ActionScript's performance, feature set, ease of use, cleanliness, and sophistication are considerable. Essentia......一起来看看 《Essential ActionScript 3.0》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具