Another Node.js use case - quickly develop stub web services for testing?

Date: Wed Sep 20 2017 testing »»»» REST »»»» Web Development
In case you're looking for reasons to play with or use Node.js, here's an intriguing thought.  Suppose you've designed a web service (e.g. with a REST interface), that service hasn't been coded yet, but you need to write some code that uses the service.  Or suppose you need to mock out the actual web service for unit tests of client code.  Why not whip up a quick implementation that returns dummy data?

It's straight-forward in Node.js to develop a REST service that deals with JSON objects, and there are plenty of ways to host such services temporarily during development or testing.  That's what Jeff Douglas mentions in his blog post (see link below), however he suggests hosting the test service over on Heroku.  But..what..if...?

For example your development or test environment may be inside a corporate intranet that doesn't allow casual access to sites outside that intranet.  This may be especially true for test/staging environments where, for security reasons, your test code is not allowed to access anything outside the secured staging environment.  Seems to me it would be easy enough to build such a test/mock/dummy service so it can be deployed ad-hoc on your internal network easily enough.

http://blog.jeffdouglas.com/2012/02/02/using-node-js-to-host-development-web-services/