Last active
December 2, 2019 23:56
-
-
Save pta2002/e79f695146048809a29920cd83b47d54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local router = (require "fw.router")() | |
router:any("/", function(req, res) | |
res.header.content_type = "text/plain" | |
res:write "hello world" | |
end) | |
router:any("/user/:name", function(req, res) | |
res:write ("hello, " .. name) | |
end) | |
router:group("/auth/", function(r) | |
r:before(function(ctx) | |
end) | |
r:any("/login/", function(req) | |
write "login" | |
end) | |
end) | |
router:plug("/stuff/", router) | |
return function () | |
ngx.say("URL: " .. tostring(ngx.var.uri) .. " METHOD: " .. ngx.var.request_method .. '\n') | |
router:compile() | |
router:nginx() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment