As the cold autumn winds and frost nipped at our heels, the LoopBack team kept warm with generous portions of hot tea and coffee and accomplished their planned October milestone goals.
We focused on the following areas:
- Inclusion of related models
- Adding Partitioned Database Support for Cloudant and CouchDB connector
- Spike on Migration Guide
- Improvements to Shopping Cart Example
- CASCON x Evoke 2019 Workshop Preparation
- Repository Tests for PostgreSQL
- Generating Controller/Repository from a Model
- Documentation Improvements
- Bug fixes / CI fixes
See the October milestone for an overview of what we have worked on, and read on for more details.
Also, we were honored this month when API World awarded LoopBack with the
2019 Best of API Middleware Award. Raymond Feng was there to accept the award on behalf of the team. Yay, team!
Inclusion of Related Models
We’ve been working on inclusion resolvers for relations for the past several months. Besides the basic functionality, we also added a prompt for activating the inclusion resolver for the
lb4 relation command in PR #3856. This allows users to easily set up the inclusion resolver through the CLI just like all others artifacts.
lb4 relation command now prompts to confirm if an inclusion resolver should be registered for the given relation.
Also, we posted a blog to illustrate the idea and usage of the inclusion resolver. We have a full example from setting up the models and relations through CLI, to querying data with the inclusion resolver. Read the blog to try out the feature!
We’ve gotten feedback from the community since this feature was published. As a result, we’ve improved the documentation. Diagrams were added to each relation to make the concept more intuitive. We also added URLs as examples to query related models in case users want to process data at the controller level instead of the repository level. See PR #4007 for more details.
Adding Partitioned Database Support for Cloudant and CouchDB connector
Both Cloudant and CouchDB support partitioned databases which make querying less expensive - computationally in CouchDB, monetarily on Cloudant (on
A spike was performed to investigate the work required to support the partitioned database in Cloudant, and follow-up tasks were created. Epic #219 - Add support for partitioned database was created to track the implementation stories.
The feature will be supported in 3 stages. In the first stage, we will update the driver and enable creating the partitioned index; which are the pre-requisites for the partitioned search. The second stage includes supporting the query with partition key from the options data or the payload data; the latter one requires a model property defined as the partition key field. Stage 3 contains more improvements for the document creation in the partitioned database by supporting a composed ID.
Spike on Migration Guide
A spike was performed on migrating from LoopBack 3 to LoopBack 4. As a result, we created the outline of a migration guide.
Improvements to Shopping Cart Example
The shopping cart application has undergone a few improvements.
We have added an out-of-the-box capability to set a JWT token via an
Authorize button/dialogin the API Explorer. When interacting with the secured endpoint, the token is automatically sent in the
Authorizationheader of the request. See PR #301 and PR #3876 for details. To find out how to enable this capability in your application, please see Specifying the Security Settings in the OpenAPI Specification.
The shopping cart application has been decomposed into multiple microservices, each of which is packaged as a docker image. It’s possible to communicate between microservices using REST and/or gRPC. A helm chart can now be used to deploy these microservices to a Kubernetes cluster on Minikube or IBM Cloud. See Deploy the Shopping Application as Cloud-native Microservices using Kubernetes for more details.
shoppingservice can now connect to the
recommenderservice over gRPC as well as REST. See PR #333 for details.
Extra logic was added to
*.datasources.tsfiles to accept configuration from kubernetes environment variables. See PR #338 for details.
CASCON x Evoke 2019 Workshop Preparation
The LoopBack 4 team has prepared material for a booth and workshop at CASCON x Evoke 2019 in Toronto, Canada. We hosted a booth named REST APIs with LoopBack 4 and OpenAPI 3 on November 4th and 6th and held a workshop named Write scalable and extensible Node.js applications using LoopBack 4 on November 5th. Watch for an upcoming blog post with an overview of the event!
Repository Tests for PostgreSQL
Previously, we ran repository tests against the memory, MySQL, and MongoDB databases. This month, we added PostgreSQL to the databases these tests are run against. You can see PR #3853 for details or take a look at the newly added
Generating Controller/Repository from a Model
Some progress was made on the EPIC #2036 - From model definition to REST API with no custom repository/controller classes. A controller can now be generated based on a model name. See PR #3842 for details. Also, a repository can now be generated based on a model name. See PR #3867 for details.
New ‘Inside a LoopBack Application’ Section Added to Docs
We’re always seeking to improve our documentation. We’ve added a new section Inside a Loopback Application to help LoopBack 4 application developers to establish a high level understanding of how LoopBack 4 is related to their application requirements.
Customize Id and Foreign Key Names for Relations
After triaging some issues from the community, we realized that the documentation for customizing key names needs to be enhanced. We added explanations and examples to illustrate the default value of relations, how to customize key names, and how to use different names for models and database columns. You can find more details in HasMany - Relation Metadata, HasOne - Relation Metadata, and Defining a belongsTo Relation.
Bug Fixes / CI Fixes
Fixed Issue #3717 - PersistedModel’s updateAll method crashes the server when invoked via the remote connector by properly handling anonymous object types when
PersistedModel.updateAllis called. See PR #472 for details.
Fixed Issue #3878 - lifeCycleObserver is not working with express composition. See PR #3879 and PR #3891 for details.
Fixed Issue #3706 - Unable to POST on endpoint with recursive model. See PR #3897 for details.
Fixed Issue #3296 - Model discovery not working with Oracle connector & CDB instance by only calling back once the connection is released. See PR #193 for details.
Looking for User References
If you’re interested in what we’re working on next, you can check out the November Milestone.
Call to Action
LoopBack’s success depends on you. We appreciate your continuous support and engagement to make LoopBack even better and meaningful for your API creation experience. Here’s how you can join us and help the project:
- Report issues.
- Contribute code and documentation.
- Open a pull request on one of our “good first issues”.
- Join our user group.