...

/

Solution: Building APIs

Solution: Building APIs

Let's practice implementing a working version of the Credit-Check API.

In this challenge, the task was to use the design assets to implement a working API service using Node.js and the DARRT library. The three key tasks are these:

  1. Install the DARRT library into the Node.js project.
  2. Update the DARRT files (data, action, resources, representations, and transitions).
  3. Once the API is completed, run a happy-path validator script.

Installing the DARRT Library

Execute the following command:

npm run dev

This should start up the API project and output something that looks like this:

> credit-check@1.0.0 dev /credit-check
> nodemon index

[nodemon] 2.0.18
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index index.js`
listening on port 8181!

Note: Don’t forget to execute npm run dev in the second terminal. Make sure you set the path by executing cd usercode/credit-check before doing so. Click the “+” sign to open the second terminal.

Now test the API ...