LoopBack 3 – Simple API Example

I am developing APIs with Node.js and LoopBack during last one year. So, it is time to create a post about it. 🙂 I try to build a detailed project. I hope that this post will be a good reference for developers.

Install LoopBack CLI Tools

There are two LoopBack CLI Tools.

You can also use the legacy StrongLoop CLI tool slc

Install LoopBack CLI Tool

$ npm install -g loopback-cli

This installs the lb command-line tool for scaffolding and modifying LoopBack applications.

Install IBM API Connect v5 developer toolkit

$ npm install -g apiconnect

IBM API Connect v5 developer toolkit includes:

  • The graphical API Designer tool that you can use to create and modify LoopBack applications.
  • The apic command-line tool for scaffolding and modifying LoopBack applications.

Create a Simple API

If using loopback-cli

$ lb

If using apic

$ apic loopback

If using slc

$ slc loopback

I have used LoopBack CLI in the following video

Run the application and API Explorer

Run the following command in Terminal to start loopback application.

$ npm start

Open your browser to http://localhost:3000/explorer

LoopBack API with InMemory Datasource Example

You can find LoopBack 3 project in the following repository.

https://github.com/kenanhancer/loopback3-simple-api.git

Leave a Reply

Your email address will not be published. Required fields are marked *