====================================================
-
LoopBack 4, the next step in the evolution of LoopBack! A completely redesigned modular framework especially for API developers.
-
Follow the Loopback 4 tutorial using this Glitch project!
-
Following instructions at loopback v4 page http://v4.loopback.io/getting-started.html
====================================================
- [done] install Node.js
- [done] installed loopback version 4 using the following command:
pnpm install --save-dev @loopback/cli
- To create a new project, run the CLI as follow
-
Type the following command the console
lb4 app
-
Answer the prompts as follows.
[?] Project name: hello-loopback4 [?] Project description: hello-loopback4 [?] Project root directory: hello-loopback4 [?] Application class name: HelloApplication [?] Select project build settings: Enable tslint, Enable prettier, Enable mocha, Enable loopbackBuild
-
Move and edit the lb4 generated project files
# move the lb4 generated project files mv ./hello-loopback4/README.md ./README-hello-loopback4.md # reference the generated README from this Glitch README sed -i '$a\ [README-hello-loopback4](./README-hello-loopback4.md)' README.md mv ./hello-loopback4/{.[!.],}* . rm -r ./hello-loopback4 # update to node version 10 sed -i 's/>=8.9/10.x/' ./package.json # Sync Glitch console with the Glitch project refresh
- The project comes with a "ping" route to test the project. Let's try it out by running the projects.
-
Wait for Glitch project to finish rebuilding
-
In a browser, visit this Glitch remix
-
and with curl test the PING api
curl -X GET "https://hello-loopback4-test01.glitch.me/ping" \ -H "accept: application/json"