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 live online training, plus books, videos, and digital content from nearly 200 publishers.