Last active
December 30, 2015 13:48
-
-
Save leafo/7837657 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 lapis = require("lapis") | |
local app = lapis.Application() | |
app:match("/user/:id", function(self) | |
return "Hello user " .. self.params.id | |
end) | |
-- named route | |
app:match("about", "/about", function() | |
return "welcome to the about page" | |
end) | |
app:get("/item/:id", function() | |
return { json = { name = "the item" } } | |
end) | |
app:post("/item/:id", function(self) | |
return { redirect_to = self:url_for("about") } | |
end) | |
return app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment