O'Reilly logo

The Node Craftsman Book by Manuel Kiessling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a route for retrieving categories

We currently only provide keywords data through our backend API. The app requests keywords data as well as categories data, and the latter would fail for now. Let's implement the required route and logic now.

We first need to extend the spec in spec/e2e/apiSpec.js:

 'use strict'; var request = require('request'); var dbSession = require('../../src/backend/dbSession.js'); var Server = require('../../src/backend/server.js').Server; var resetDatabase = require('../resetDatabase.js'); var async = require('async'); describe('The API', function () { var server; beforeEach(function (done) { server = Server('8081'); server.listen(function (err) { resetDatabase(dbSession, function() { done(err); }); }); }); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required