Powered by fortunejs, we don't need to worry about ORM-stuff by simply defining database entities in the jsonmodel.
Flowee runs in memory by default, and automatically detects databases when installed.
The definitions
field in the jsonmodel allows you to define entities and their relationships:
...
definitions: { <-- here the database entities are defined
user: { <-- name of the entity, this translates to api endpoint '/user' and '/user:id'
name: { <-- attribute
type: String <-- type of the attribute
...
It uses the fortunejs defineType
format: see docs at fortunejs
Each entity will automatically expose the following REST-endpoints during flowee.init()
:
Just look at ./model.generated.json
in the /path
-field after running flowee.
Or do a GET /model
request.
Important: make sure to do request with the
Content-Type: application/vnd.api+json
http header.
npm install fortune-nedb
npm install fortune-mongodb
or npm install fortune-redis
npm install fortune-postgres
Databases are automatically configured by monkeypatching the generated model with default settings.
Just look at
./model.generated.json
in theadapter
-field after running flowee. Or do aGET /model
request.
Copy/paste/modify the adapter
-settings into your model.