Enter Your Email Address to Watch This Lesson

Your link to unlock this lesson will be sent to this email address.

Unlock this lesson and all 986 of the free egghead.io lessons, plus get Node.js content delivered directly to your inbox!

Existing egghead members will not see this. Sign in.

Initialize a LoopBack Node.js Project through the CLI

1:17 Node.js lesson by

LoopBack is a framework built on top of Express for creating APIs. It allows you to create end-to-end REST APIs that can access data from many data sources such as MondoDB, PostgreSQL, MySQL or other REST APIs.

In this lesson you will learn how to install loopback-cli and create a new LoopBack API project. After creating the basic LoopBack project through the CLI, running the server will give us access to the project and API Explorer urls. The user model will be available to us because user authentication was enabled.

Get the Code Now
click to level up

egghead.io comment guidelines


In this lesson you will learn how to install loopback-cli and create a new LoopBack API project.

The first thing we do is install LoopBack CLI, globally. This will give us access to the lb commands that we can use to build LoopBack applications. Next, we will create a folder called eggheadloopback, and cd into it.

We'll run lb app in our new directory to create our LoopBack API project. This will prompt us for a couple of things. First, it asks us the name of the application. We accept the defaults. This is the name of the directory that we are in.

The second question is which version of LoopBack we'd like to use. We pick version 3.x, which is the current version. The last question is the kind of application that we'd like to create. We accept the default, which is an API server with local user authentication enabled.

The basic project will be created, and the dependencies will be installed using npm-install. After the installation is finished, we can start the API by running node., or npm-start. This will print out two URLs, to the API and to the explorer.

When we open the first URL in the browser, we see a status message. This message shows us when the API was started and the up time. The second URL shows us the API explorer that can be used to interact with the API.

It currently shows one model, the user model. This built-in model is enabled because we selected an API server with local user authentication.

Joel's Head
Why are we asking?