Skip to content

Commit 1030027

Browse files
authored
release v0.6.2 (#55)
1 parent 24e28e4 commit 1030027

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package = "radix-router"
2+
version = "0.6.2-1"
3+
4+
source = {
5+
url = "git://github.com/vm-001/lua-radix-router",
6+
tag = "v0.6.2",
7+
}
8+
9+
description = {
10+
summary = "Fast API Router for Lua/LuaJIT",
11+
detailed = [[
12+
A lightweight high-performance and radix tree based router for Lua/LuaJIT/OpenResty.
13+
14+
local Router = require "radix-router"
15+
local router, err = Router.new({
16+
{ -- static path
17+
paths = { "/foo", "/foo/bar", "/html/index.html" },
18+
handler = "1" -- handler can be any non-nil value. (e.g. boolean, table, function)
19+
},
20+
{ -- variable path
21+
paths = { "/users/{id}/profile-{year}.{format}" },
22+
handler = "2"
23+
},
24+
{ -- prefix path
25+
paths = { "/api/authn/{*path}" },
26+
handler = "3"
27+
},
28+
{ -- methods condition
29+
paths = { "/users/{id}" },
30+
methods = { "POST" },
31+
handler = "4"
32+
}
33+
})
34+
if not router then
35+
error("failed to create router: " .. err)
36+
end
37+
38+
assert("1" == router:match("/html/index.html"))
39+
assert("2" == router:match("/users/100/profile-2023.pdf"))
40+
assert("3" == router:match("/api/authn/token/genreate"))
41+
assert("4" == router:match("/users/100", { method = "POST" }))
42+
43+
-- variable binding
44+
local params = {}
45+
router:match("/users/100/profile-2023.pdf", nil, params)
46+
assert(params.year == "2023")
47+
assert(params.format == "pdf")
48+
]],
49+
homepage = "https://github.com/vm-001/lua-radix-router",
50+
license = "BSD-2-Clause license"
51+
}
52+
53+
dependencies = {
54+
"lrexlib-pcre2",
55+
}
56+
57+
build = {
58+
type = "builtin",
59+
modules = {
60+
["radix-router"] = "src/router.lua",
61+
["radix-router.options"] = "src/options.lua",
62+
["radix-router.route"] = "src/route.lua",
63+
["radix-router.trie"] = "src/trie.lua",
64+
["radix-router.utils"] = "src/utils.lua",
65+
["radix-router.constants"] = "src/constants.lua",
66+
["radix-router.iterator"] = "src/iterator.lua",
67+
["radix-router.parser"] = "src/parser/parser.lua",
68+
["radix-router.parser.style.default"] = "src/parser/style/default.lua",
69+
["radix-router.matcher"] = "src/matcher/matcher.lua",
70+
["radix-router.matcher.host"] = "src/matcher/host.lua",
71+
["radix-router.matcher.method"] = "src/matcher/method.lua",
72+
},
73+
}

0 commit comments

Comments
 (0)