Chapter 6Test-Drive Express Apps

Express is lightweight and makes writing Node.js web apps a breeze. With Express you don’t have to write any code to read and render HTML files. You don’t need to parse the query strings or manually map the URL paths or routes to handler functions. Simply configure the necessary details and the framework takes care of the rest for you.

It’s great that Express does so much, but it may not always be clear how to automate the tests for code written in Express. That’s because, when a request arrives, Express invokes the appropriate routes function and pushes the response to the client after the function completes. The code we write to handle the requests is not called directly from an application’s code. ...

Get Test-Driving JavaScript Applications 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.