Last active
August 29, 2015 14:21
-
-
Save nuclearsandwich/0b0c05aad7144ffae171 to your computer and use it in GitHub Desktop.
Lapis errors with before filter.
This file contains hidden or 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() | |
local github_auth = require("github/auth"); | |
app:enable("etlua") | |
app.layout = require("views.layout") | |
app:before_filter(function(self) | |
if not self.current_user then | |
self:write({ | |
redirect_to = github_auth.authentication_url_for(request, self:url_for("oauth_callback"))}) | |
end | |
end) | |
app:get("index", "/", function(self) | |
return { render = "index" } | |
end) | |
app:get("oauth_callback", "/auth/callback", function(self) | |
return "whateverrr" | |
end) | |
return app |
This file contains hidden or 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
2015/05/21 20:56:13 [error] 4731#0: *19 lua entry thread aborted: runtime error: ./app.lua:9: attempt to call field 'before_filter' (a nil value) | |
stack traceback: | |
coroutine 0: | |
[C]: in function 'require' | |
/home/steven/.luarocks/share/lua/5.1/lapis/init.lua:15: in function 'serve' | |
content_by_lua(nginx.conf.compiled:23):2: in function <content_by_lua(nginx.conf.compiled:23):1>, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment