Adding Search APIs
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) => { |
â | |
â |
Get Node.js 8 the Right Way now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.