In this tutorial we're going to create a database schema, a set of APIs and test them. It assumes that you have access to a Fostgres build and that you have a Postgres server you can use.
We're going to build a simple to-do system. Not becuase it's a particularly interested problem, but rather because it isn't. It'll allow us to focus on the key aspects important to Fostgres:
- What does a good database schema look like.
- What do a set of good RESTful APIs look like.
- How can we test that we will get the right results.
There are two main components, the to-do list and the to-do items on the list. We can start with this very simple schema and then make improvements until we have something we like:
CREATE TABLE todo (
name text,
PRIMARY KEY (name)
);
CREATE TABLE task (
todo_name text,
item text,
PRIMARY KEY (todo_name, item)
);
You can install a suitable version of Fostgres using the Fost snap.
sudo snap install fost --devmode --edge
alias fostgrest-test=fost.fostgres-test