1.0.7 • Published 7 years ago
dolt-server v1.0.7
dolt-server
a simple server for mocking test data
dolt-server is a tiny node module intended to allow developers to mock server responses for integration tests. You can start a server at a given port and mock any endpoint with a specific response.
It accepts all cross-origin requests so please don't use it for anything that needs to be secure. This is not fully featured and I totally hacked it together for work, but feel free to use it for your purposes and contribute or open issues.
Getting Started
dolt-server can be installed through NPM:
npm install --save-dev dolt-server
API Reference
const doltserver = require('dolt-server')
// start the server at a given port
doltserver.start(3000)
// mock an endpoint
doltserver.mock({
/* Supported methods: GET, POST, PUT, DELETE */
method: 'GET',
/* All URLs are `http://localhost:PORT/${path}` */
path: '/',
/* Response can be a string, number, array, or object */
response: { message: 'Hello world!' }
})
// stop the server
doltserver.stop()