1.0.0 • Published 7 months ago

nock-mock-server v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Nock Mock Server

npm License

A simple mock server powered by nock.

Installation

Install the package using npm:

npm install nock-mock-server

Usage

Create a mock server instance and add mocks:

// index.js
const { NockMockServer } = require("nock-mock-server");

const PORT = 3000;
const nockServer = new NockMockServer();

nockServer.addMock((nockInstance) => {
  nockInstance.get("/").reply(200, { message: "Hello World" });
});

nockServer.start(PORT, () => {
  console.log("Nock server started");
});

Examples

You can find more examples in the examples directory.

License

This project is licensed under the MIT License. See the LICENSE file for details.