Skip to content

API: Database Operations with Objection.js

Jake Lee Kennedy edited this page Nov 3, 2019 · 2 revisions

The Objection.js documentation is very extensive; if you think there should be an elegant way to do something there probably is.

There are models and schemas defined with many useful functions available.

The models should define any relations that are present so that they can be loaded using.

There is a _model.js class that all models should extend with some additional functionality like parsing the model to JSON and back in an ember friendly way, and for hiding fields which should not be exposed.

The schemas are used for validation of JSON and models, they will be more or less the same but may have differences. The schemas are included in the Objection.js models for validating input. And they can be used for testing the response of the API using mocha.

Clone this wiki locally