January 2018
Intermediate to advanced
336 pages
7h 22m
English
With the basic structure of the web services project in place, it’s time to start adding some APIs. First we’ll add APIs for searching the books index, and then we’ll add APIs for creating and manipulating book bundles.
To begin, open a terminal to your b4 project directory and add a new subdirectory called lib. This will house the individual modules that contribute API code for the service.
Next, open a text editor and enter the following skeleton code for the search APIs.
| | /** |
| | * Provides API endpoints for searching the books index. |
| | */ |
| | 'use strict'; |
| | const request = require('request'); |
| | module.exports = (app, es) => { |
| | |
| | const url = `http://${es.host}:${es.port}/${es.books_index} ... |
Read now
Unlock full access