Skip to content

Instantly share code, notes, and snippets.

@nuclearsandwich
Last active August 29, 2015 14:21
Show Gist options
  • Save nuclearsandwich/0b0c05aad7144ffae171 to your computer and use it in GitHub Desktop.
Save nuclearsandwich/0b0c05aad7144ffae171 to your computer and use it in GitHub Desktop.
Lapis errors with before filter.
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
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