Creating the route for deleting keywords

Now it's time for the final step. We need to add route handling for DELETE requests, and our application is complete.

Once again, we start with the spec:

 it('should remove a keyword when receiving a DELETE request at \ /api/keywords/: id/', function (done){ var expected = { "_items": [ {'id': 1, 'value': 'Aubergine', 'categoryID': 1} ] }; async.series( [ function(callback) { dbSession.insert( 'category', {'name': 'Vegetable'}, function(err) { callback(err) }); }, function(callback) { dbSession.insert( 'keyword', {'value': 'Aubergine', 'categoryID': 1}, function(err) { callback(err) }); }, function(callback) { dbSession.insert( 'keyword', {'value': 'Onion', 'categoryID': 1}, function(err) { callback(err) ...

Get The Node Craftsman Book 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.