LoopBack 4 Todo Application Tutorial - Putting it all together

Putting it all together

We’ve got all of our artifacts now, and they are all automatically bound to ourApplication so that LoopBack’sDependency injection system can tie it all togetherfor us!

LoopBack’sboot modulewill automatically discover our controllers, repositories, datasources and otherartifacts and inject them into our application for use.

NOTE: The boot module will discover and inject artifacts that follow ourestablished conventions for artifact directories. Here are some examples:

  • Controllers: ./src/controllers
  • Datasources: ./src/datasources
  • Models: ./src/models
  • Repositories: ./src/repositories

To find out how to customize this behavior, see theBooters section ofBooting an Application.

Let’s try out our application! First, you’ll want to start the app.

  1. $ npm start
  2. Server is running at http://127.0.0.1:3000

Next, you can use the API Explorer to browseyour API and make requests!

Here are some requests you can try:

  • POST /todos with a body of { "title": "get the milk" }
  • GET /todos/{id} using the ID you received from your POST, and see if youget your Todo object back.
  • PATCH /todos/{id}, using the same ID, with a body of{ "desc": "need milk for cereal" }That’s it! You’ve just created your first LoopBack 4 application!

Where to go from here

There are still a ton of features you can use to build on top of theTodoListApplication. Here are some tutorials that continues off from where weleft off here to guide you through adding in an additional feature:

  • Integrate with a REST based geo-coding service: A typical REST API serverneeds to access data from a variety of sources, including SOAP or RESTservices. Continue to the bonus section to learn how LoopBack connectors makeit super easy to fetch data from other services andenhance your Todo application with location-based reminders.
  • Add related Model with TodoListApplication: If you would like to try outusing some of the more advanced features of LoopBack 4 such as relations, tryout theTodoList tutorialwhich continues off from where we leave here.

More examples and tutorials

Eager to continue learning about LoopBack 4? Check out ourExamples and Tutorials sections to find examplesfor creating your own custom components, sequences and more!

Navigation

Previous step: Add a controller