From fe2771042106a4324d69c1976e32594a925a0561 Mon Sep 17 00:00:00 2001 From: Sam Dodrill Date: Mon, 5 Jan 2015 19:09:03 -0800 Subject: [PATCH] test session data --- app.moon | 7 ++++--- views/index.moon | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app.moon b/app.moon index 0b17bab..20233ba 100644 --- a/app.moon +++ b/app.moon @@ -10,8 +10,9 @@ import respond_to from require "lapis.application" require "models.user" class App extends lapis.Application - "/": => - render: "index" + [index: "/"]: => + @user = @session.user + render: true [list: "/list"]: => user = Users\find id: @session.user @@ -38,7 +39,7 @@ class App extends lapis.Application @params.extension = "9001" 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\write_session @ diff --git a/views/index.moon b/views/index.moon index 3f8de32..7070dbb 100644 --- a/views/index.moon +++ b/views/index.moon @@ -5,3 +5,6 @@ class Index extends Widget h1 class: "header", "Hello" div class: "body", -> text "Welcome to my site!" + + if @user + h2, "I think you are UID #{@user}"