Originally published on strongloop.com
The past few weeks have been challenging for many of us. While this pandemic situation affected our lives in different ways, we hope you all stay safe.
In Q1, we continued to make good progress in the following areas:
- Migration guide
- Migration Tooling and Examples
- From Model Definitions to REST APIs
- Newly added examples
- Newly added extensions
- Enhancements in LoopBack core and OpenAPI areas
- Rework of shopping example
- Refreshed look for LoopBack documentation
Let's take a closer look.
Building the migration guide is one of the key focuses for us this year. We made good progress in completing the migration guide. Please check out our migration guide. LoopBack 3 is currently in maintenance LTS. Read this blog to find out what it means and how it affects you.
In LB3, it was possible to use mixins to enhance a model with a new property, a custom method, or a custom remote method. In LB4, this can be accomplished by using a mixin class factory function against model, repository, or controller classes. We added a Migrating model mixins page to demonstrate how to accomplish this.
In LB3, Operation hooks are useful tools that are triggered by all methods that execute a particular high-level CRUD operation. However, LB4 hasn't supported this feature yet. To help LB3 users to continue using the feature, we provide a workaround and explain how they can migrate LB3 operation hooks to LB4 repositories in page Migrating operation hooks.
LB3 has the built-in User/AccessToken model based authentication. In LB4, we provide a more flexible authentication system. We explain how LB3 users can migrate it to LB4 with handy LB4 CLI tools. The content can be found in page Migrating built-in authentication.
In addition, we added the LB3 features not in-plan documentation page to clarify which LB3 features are not supported in LB4 or the workarounds for those features if users would like to continue using them in LB4.
Migration Tooling and Examples
Besides documentation, we migrated the LoopBack 3 access control example to LoopBack 4. In the lb3-application example, we added instructions on how to move the middleware from the LoopBack 3 application to a common location where both the LB3 and LB4 applications can use it.
For tooling that helps your migration process easier, the
lb4 import-lb3-models command now supports migrating models inheriting from all other models, including LoopBack 3 built-in models.
From Model Definitions to REST APIs
One of the frequent inputs we got from users is that they would like to see fewer steps from creating the models to having runnable endpoints. We now have the
rest-crud package, the app booter, and the CLI command. You can see how to create a simple LoopBack 4 app with the
lb4 rest-crud CLI command.
Integrate with IBM API Connect
Earlier, we identified the work items required for the integration with IBM API Connect. When importing an OpenAPI spec generated by a LoopBack 4 application, there is additional metadata needs to be added. Instead of having our users to modify the OpenAPI spec manually, we introduced an API Connect OpenAPI enhancer to inject the
x-ibm-configuration and other required attributes in the OpenAPI spec.
Additionally, we extracted and translated the messages for our CLI tooling.
Newly Added Examples
We continue to add examples which demonstrate commonly used scenarios. With the growing number of examples, we also categorized the Example list. Here are the newly added examples:
access control migration example to show how to migrate a LoopBack 3 application with access control to LoopBack 4.
file transfer example for exposing APIs to upload and download files using Express Multer.
validation example for adding different kinds of validations in a LoopBack 4 application.
rest-crud example for using
CrudRestComponentto define repository and controller classes for a model without creating those classes
If there's any example you'd like to see, feel free to open an issue in the loopback-next repo. Better yet, submit a PR and contribute!
Newly Added Extensions
LoopBack 4 is designed to be extensible. We added three extensions in this quarter for various usages:
@loopback/extension-logging provides logging facilities based on Winston and Fluentd.
IBM Db2 for i Connector
The IBM Db2 for i connector was added to the connector list. You can now conveniently create a IBM Db2 for i datasource using our CLI. If you are starting a new project that connects to IBM Db2 for i, we recommend you to use this connector instead of
loopback-connector-db2iseries connector. You can find more details in the Db2 for i connector page.
Enhancements in LoopBack core and OpenAPI areas
In this quarter, thanks to our community contributors, we had a number of important enhancements in the OpenAPI area. An
OASEnhancerService was introduced which allows other enhancers to register and contribute OpenAPI specs into the application. This also provides the base for the API Connect OpenAPI enhancer mentioned above. On top of that, a few OpenAPI convenience decorators were added, for example, the
@deprecated() decorator and the
@tags(tagNames: string ) decorator for a class and method.
For the core of the framework, we have added the support hot-loading of controllers during application startup. Besides, the context and binding inspection APIs were improved with more options and information to print out their injections. More details can be found in the February milestone blog.
Rework of Shopping Example
The most noticeable changes for our shopping example is the newly added frontend. There was some rework on the authentication and authorization side to make the app working from end to end.
Refreshed Look for LoopBack Web Site
Last but not least, if you haven't noticed already, our documentation site has a refreshed look. Don't forget to check it out!
Previous Milestone Blogs
There are many more accomplishments that cannot be captured in this blog, make sure you check out our previously published monthly milestone blog posts in Q1 for more details:
- finish migration guide for both general runtime and authentication & authorization
- continue with API Connect and LoopBack integration
- look into feature parity gaps that are highly requested by users
Call to Action
In 2020, we look forward to helping you and seeing you around! 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.