Tutorial: Create Rest API with LoopBack 4

Afonso Antunes
Apr 14, 2021


Hi people!!

In this tutorial, I will show you how to build an API using node.js and, especially, LoopBack 4.

To do this, you only need the PC’s command line.

1st step: Install node.js and LoopBack 4

npm init
npm i -g @loopback/cli

2nd step: Create the app scanffolding

3rd step: Add the Model

4th step: Add a Datasource

5th step: Open the db.json file and enter the following code

6th step: Add a Repository

7th step: Add a Controller

Last step: Execute the API

npm start

The output should be as follows:

The Final Output