From dd4001677599ed7fb386907f4aa941050a9d9d6d Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 17 Mar 2024 16:03:28 -0500 Subject: [PATCH] added layouts, db support --- .help | 0 app.lua | 24 ++++++++++++++++++++++-- config.lua | 6 +++++- player.lua | 0 views/index.etlua | 21 +++------------------ views/layout.etlua | 12 ++++++++++++ 6 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 .help create mode 100644 player.lua create mode 100644 views/layout.etlua diff --git a/.help b/.help new file mode 100644 index 0000000..e69de29 diff --git a/app.lua b/app.lua index 177a46c..4e3bee7 100644 --- a/app.lua +++ b/app.lua @@ -1,17 +1,24 @@ local lapis = require("lapis") local app = lapis.Application() local say = require('lua_scripts/main') +local player = require('player') + +local db = require("lapis.db") +local Model = require("lapis.db.model").Model app:enable("etlua") +app.layout = require "views.layout" app:post("/clickme", function(self) self.plane = "P-38L" - return self.plane + return {self.plane, layout = false} end) app:get("/", function(self) self.text = say.hello() - return {render = "index"} + return {render = "index", + + } end) return app @@ -33,6 +40,19 @@ return app + + + + + + + + + + + + + diff --git a/config.lua b/config.lua index e63bdfd..fd412a1 100644 --- a/config.lua +++ b/config.lua @@ -3,5 +3,9 @@ local config = require("lapis.config") config("development", { server = "nginx", code_cache = "off", - num_workers = "1" + num_workers = "1", + sqlite = { + database = "my_database.sqlite", + -- open_flags = ... + } }) diff --git a/player.lua b/player.lua new file mode 100644 index 0000000..e69de29 diff --git a/views/index.etlua b/views/index.etlua index 9621738..ed17d69 100644 --- a/views/index.etlua +++ b/views/index.etlua @@ -1,29 +1,14 @@ -

Hello world

-

Welcome to my page

-

The missile guidance system works as follows

- -
-
- Give Us Money - - -
-
- - -
-
-
- - +

    + diff --git a/views/layout.etlua b/views/layout.etlua new file mode 100644 index 0000000..feef71c --- /dev/null +++ b/views/layout.etlua @@ -0,0 +1,12 @@ + + + + + <%= page_title or "My Page" %> + + + +

    Peradventure

    + <% content_for("inner") %> + +