Skip to content

Commit cb39986

Browse files
committed
add the tiny-twitter example from pgconf.eu 2023
1 parent 2b6b981 commit cb39986

File tree

7 files changed

+54
-1
lines changed

7 files changed

+54
-1
lines changed

examples/tiny_twitter

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/tiny_twitter/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sqlpage.bin

examples/tiny_twitter/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM lovasoa/sqlpage:main
2+
3+
COPY sqlpage /etc/sqlpage
4+
COPY . /var/www/

examples/tiny_twitter/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Tiny Tweeter
2+
3+
This is a simple example of a very simple Twitter-like application running on top of PostgreSQL.
4+
It is called tweeter because Elon Musk already has the Twitter trademark, even though he doesn't use it.
5+
6+
It was presented at the [2023 PGConf.EU](https://2023.pgconf.eu/) conference.
7+
8+
You can find the slides at https://sql.ophir.dev/pgconf/pgconf-2023.html.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
sqlpage:
3+
build: .
4+
ports: ["8080:8080"]
5+
volumes: [".:/var/www"]
6+
depends_on: [postgres]
7+
environment:
8+
- DATABASE_URL=postgres://root:root@postgres/sqlpage
9+
postgres:
10+
image: postgres:16
11+
ports: ["5432:5432"]
12+
environment:
13+
- POSTGRES_USER=root
14+
- POSTGRES_PASSWORD=root
15+
- POSTGRES_DB=sqlpage

examples/tiny_twitter/index.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
select 'shell' as component,
2+
'TinyTweeter' as title;
3+
4+
select 'form' as component,
5+
'Tweet' as validate;
6+
select 'new_tweet' as name,
7+
'Your story' as label,
8+
'textarea' as type,
9+
'Tell me your story...' as placeholder;
10+
select 'checkbox' as type,
11+
'Terms and conditions' as label,
12+
true as required;
13+
14+
insert into tweets (tweet)
15+
select :new_tweet
16+
where :new_tweet is not null;
17+
18+
select 'card' as component,
19+
'Tweets' as title,
20+
1 as columns;
21+
select tweet as description
22+
from tweets;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CREATE TABLE tweets(
2+
id bigserial,
3+
tweet text
4+
);

0 commit comments

Comments
 (0)