mock-responses
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "mock-responses", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "espress-kind http request middleware", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,5 +5,11 @@ # mock-responses | ||
Is your back-end api not ready, too slow, or unstable? You don't have to wait for that by mocking all back-end responses using `mock-responses`. | ||
Is your back-end api not ready, too slow, or unstable? | ||
Your front-end development is dependent on several APIs and they affect your development? | ||
You don't have to wait any more by mocking all back-end responses using `mock-responses`. | ||
Compatible with [connect](https://github.com/senchalabs/connect), [express](https://github.com/strongloop/express), [browser-sync](https://github.com/BrowserSync/browser-sync) and [many more](#compatible-servers). | ||
Compatible with; | ||
- [connect](https://github.com/senchalabs/connect) | ||
- [express](https://github.com/strongloop/express) | ||
- [browser-sync](https://github.com/BrowserSync/browser-sync) | ||
- and [many more](#compatible-servers). | ||
@@ -18,8 +24,15 @@ ![image](https://user-images.githubusercontent.com/1437734/44070798-cd75a576-9f53-11e8-86f7-d902393aa35e.png) | ||
var express = require('express'); | ||
var httpRequestMiddleware = require('mock-responses')('./mock-responses.sqlite3'); | ||
var mockResponses = require('mock-responses')('./mock-responses.sqlite3'); | ||
// Pretending express is your front-end development server, which compiles and run your code. | ||
var app = express(); | ||
app.use(httpRequestMidleware); | ||
// Add mockResponses as your code. | ||
app.use(mockResponses); | ||
app.listen(3000); | ||
``` | ||
Then, hit the urls | ||
``` | ||
http://localhost:3000/developer | ||
http://localhost:3000/my/api/path | ||
``` | ||
@@ -53,4 +66,6 @@ ## Install | ||
### 3. DONE!! | ||
Now, you can add, update, delete, or search your api responses, which is mocked but never fails. | ||
## function response example | ||
To use function, please set response content type as *`text/javascript`* | ||
``` | ||
@@ -57,0 +72,0 @@ function(req, res, next) { |
Sorry, the diff of this file is not supported yet
474871
95