Create your app scaffolding

Let’s start by creating the initial application by running the followingcommand:

  1. lb4 app soap-calculator --repositories --services

Note: The option –repositories instructs the CLI to include aRepositoryMixin class in the application constructor which will be needed whenwe create the datasource. The option –services instructs the CLI toinclude a ServiceMixin class in the application constructor which will beneeded to register our SOAP service client.

LB4 will ask you a few questions (you can leave the default options). Thedescription and the root directory are obvious. The class name referes to themain application class name for your project that will be located in theapplication.ts file.

  1. ? Project description: soap-calculator
  2. ? Project root directory: soap-calculator
  3. ? Application class name: (SoapCalculatorApplication)

Next you will see a list of options for the build settings, if you did notspecify —repositories and —services in the last command, then you will seethem in this list, make sure you enable both the repository and the services forthe application.

Note:

Enable all options besides docker, unless you know what you are doing, seeThe Getting Started guide for more information.

  1. ? Select features to enable in the project:
  2. Enable eslint: add a linter with pre-configured lint rules
  3. Enable prettier: install prettier to format code conforming to rules
  4. Enable mocha: install mocha to run tests
  5. Enable loopbackBuild: use @loopback/build helpers (e.g. lb-eslint)
  6. Enable vscode: add VSCode config files
  7. ❯◯ Enable docker: include Dockerfile and .dockerignore
  8. Enable repositories: include repository imports and RepositoryMixin
  9. Enable services: include service-proxy imports and ServiceMixin

Run the Application

The next step is to change to the soap-calculator directory and run it, notethat LB4 automatically installed the dependency packages for you, so no needto run npm install before running it.

  1. cd soap-calculator
  2. npm start

You will see the app running on port 3000 by default, you can point your browserto http://localhost:3000/ping and see a greeting message from LB4.

Note:

Press Ctrl-C to stop running the application and continue to the nextstep.

Navigation

Previous step:Soap Web Service Overview

Next step: Add a Datasoure