nerack repo
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
CREATE TABLE IF NOT EXISTS greetings (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
select name
|
||||
from greetings
|
||||
limit 1;
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <nerack.h>
|
||||
#include <http.h>
|
||||
#include <sqlite.h>
|
||||
|
||||
module(hello_world){
|
||||
sqlite(
|
||||
"hello_db",
|
||||
"file:hello.db?mode=rwc",
|
||||
{"create_hello_world_table"},
|
||||
{"seed_hello_world"}
|
||||
);
|
||||
|
||||
http("home", "/",
|
||||
.get = {
|
||||
sqlite_query({"hello_db", "get_hello_world", "hello_world_data"}),
|
||||
html("hello_world", "hello"),
|
||||
http_response("hello")
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
{{#hello_world_data}}
|
||||
<p>Hello {{name}}</p>
|
||||
{{/hello_world_data}}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,2 @@
|
||||
INSERT INTO greetings(name)
|
||||
VALUES('World');
|
||||
Reference in New Issue
Block a user