Source code for blog posts "How to mock web servers using Node.js" parts 1 and 2 which can be found here:
- How to mock web servers using Node.js - Part 1: HTTP
- How to mock web servers using Node.js - Part 2: Websockets server
This was built in Visual Studios 2015 using the Node.js extension but it can be ran like any other node project. Remember to run
npm install
to get needed dependencies and then
npm start
to start the servers.
Once started, it will make available two separate servers - one for HTTP and the other for websockets. They will be listening on the following ports:
//Ports
var httpPort = 8888;
var wsPort = 8889;
They can be tested using the included ClientWebSocket.html
file in a browser.