test session data

This commit is contained in:
Sam Dodrill 2015-01-05 19:09:03 -08:00
parent fb52546f99
commit fe27710421
2 changed files with 7 additions and 3 deletions

View File

@ -10,8 +10,9 @@ import respond_to from require "lapis.application"
require "models.user" require "models.user"
class App extends lapis.Application class App extends lapis.Application
"/": => [index: "/"]: =>
render: "index" @user = @session.user
render: true
[list: "/list"]: => [list: "/list"]: =>
user = Users\find id: @session.user user = Users\find id: @session.user
@ -38,7 +39,7 @@ class App extends lapis.Application
@params.extension = "9001" @params.extension = "9001"
if Users\find email: @params.email if Users\find email: @params.email
return "User with that email already exists" return status: 500, "User with that email already exists"
user = Users\create @params user = Users\create @params
user\write_session @ user\write_session @

View File

@ -5,3 +5,6 @@ class Index extends Widget
h1 class: "header", "Hello" h1 class: "header", "Hello"
div class: "body", -> div class: "body", ->
text "Welcome to my site!" text "Welcome to my site!"
if @user
h2, "I think you are UID #{@user}"