temporal-tables-demo
Purpose
Simple example project for an API using a database with temporal tables, this project exposes a CRUD API which have the particularity to use a temporal database, allowing to keep an history of all modifications made
Setup project
In order to setup the project to work you need Node.js, Yarn and a postgres server
Once you have all of these installed, you can install project's dependencies by running the command yarn
on the root of the repository
Then, you'll have to setup a database, fill the config/config.json file with the data you want to use (database name / port / pass etc...). You can now create your database :
yarn db:create
run the migrations :
yarn db:migrate
And then you're ready to go ! Just start the server by typing :
yarn start
This will launch a server listening on port 3000 with these routes inside :
- /v1/products POST
- /v1/products GET
- /v1/products/:id GET
- /v1/products/:id PATCH
- /v1/products/:id DELETE
Products are resources with only an id::UUID and a name::string property.
The routes to retrieve some data accepts a as_of_time query parameter, used to make the query as if we were at a different pas time, in order for instance, to recreate the data that was present at a certain time for an issue investigation.