-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
In LoopBack 3, it is very easy to get a fully-featured relational REST API with very little code: a model definition describing model relations + a model configuration specifying which datasource to use.
Let's enhance the solution provided by #2036 to include support for relations too.
This spike will focus on the hasMany relation, and will serve as an example of how to approach the other relations (supported by LB4).
-
User creates a model class and uses decorators to define a
hasManymodel relation -
User declaratively defines what kind of data-access patterns to provide (CRUD, KeyValue, etc.) and what datasource to use under the hood - will be provided by From model definition to REST API with no custom repository/controller classes #2036
-
@loopback/boot processes this configuration and registers appropriate repositories & controllers with the app.
Acceptance criteria
-
A design proposal and PoC implementation showing how can extensions contribute changes needed to expose relation APIs, e.g. register inclusion resolvers and expose new controller methods. This should build on top of From model definition to REST API with no custom repository/controller classes #2036 (see also the proposal from spike Spike: booter for creating REST APIs from model files #3617).
-
Updated
examples/todo-listshowing the proposed solution in practice. You can use the modifications from Spike: booter for creating REST APIs from model files #3617 to convert the current todo-list app to leverage ModelApiBooter. -
A spike document (a markdown file in your spike branch) explaining the proposal, documenting which different options were considered (and why they were rejected), etc. The document should also outline follow-up implementation tasks.