A simple JSON based mock server
const mockee = require('@indieatom/mockee')
mockee()
The lightest way to mock your API calls just defining a JSON in your project.
npm install @indieatom/mockee --save
# OR
yarn add @indieatom/mockee
This package is based on a JSON that contains all your mockable request. Must be like:
{
"GET": {
"/your/mocked/route/": {
"body": [{ "name": "Jordan" }]
},
"/route/with/expected/code/": {
"code": 503
}
},
"POST": {},
"PUT": {},
"DELETE": {}
}
That file could be saved in any directory inside your project and must be parsed to mockee()
.
const mockee = require('@indieatom/mockee')
// That accept your mock config by params
const mockeeConfig = {
mock: './mock/my_mock.json', // JSON mock file path location
port: 1234, // Mock server port (Default 4004)
loader: 'https://github.com' // Optinal server to load data (Set '' to use dafult not found rule)
}
mockee(mockeeConfig)
Indie Atom – [email protected]
Distributed under the MIT license. See LICENSE
for more information.
- Fork it (https://github.com/indieatom/mockee/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request