Created
October 3, 2019 00:07
-
-
Save Daij-Djan/0846d57923a0c2d20784c84f2f1105d9 to your computer and use it in GitHub Desktop.
simple mock HTTP server in node (using mock-http-server npm package)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ServerMock = require("mock-http-server"); | |
// Run an HTTP server on localhost:9000 | |
var server = new ServerMock({ host: "localhost", port: 9000 }); | |
server.start(Function()); | |
server.on({ | |
method: '*', | |
path: '*', | |
reply: { | |
status: 200, | |
headers: { "content-type": "application/json" }, | |
body: JSON.stringify({ hello: "world" }) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment