0

I'm working with multiple microservices, and sometimes I just want to ignore a microservice and replace it by a server that will always respond with HTTP 200 for any request.

By any request, I mean every type of requests (POST, GET, PATCH ..) with any body or header made on the server and on any route of the domain (e.g. server.dev/somewhere, server.dev/another/endpoint)

Do you know any existing website that does that ?

Is there an easy/fast way to run a minimal server that would do that locally ?

Obviously, it's just for my development environment, I don't need to use this in production.

Richard
  • 58
  • 6

1 Answers1

2

One easy way to do this is with node.js Something as simple as:

const http = require('http');

/*
 *  tiny webserver that always responds 200
 */

http.createServer(function (req, res) {
    res.writeHead(200);
    res.end();
}).listen(4000);

The above listens on port 4000 and would be accessable at http://localhost:4000/

njwags
  • 1,107
  • 11
  • 22