A simple sequence mock API Server. This is intended to make functional UI tests easier for SPA applications
Merver will serve API endpoints according to a YAML definition. What makes this different than other mock servers, is that you can have sequenced responses for your use cases. For example:
- POST /login fails with 403 (assumed bad credentials)
- POST /login succeeds the second time with 200 (assumed good credentials)
- GET /user/1 gives back a user with name = "Laura Johnson"
- PUT /user/1 gives back a user with name = "Laura Raghunath"
- GET /user/1 gives back a user with name = "Laura Raghunath"
Example YAML for above:
---
routes:
"/login":
POST:
responses:
- response:
message: Invalid Password
status: 403
- response:
id: 1
name: Laura Johnson
status: 200
"/user/1":
GET:
response:
name: Laura Johnson
PUT:
response:
name: Laura Raghunath
update:
"/user/1":
GET:
response:
name: Laura Raghunath
This readme in in markdown
{
"YAML":"YAML Definition"
}
{
"path":"Absolute YAML File Path"
}
{
"rawYAML": "Raw YAML Text",
"definition": {
// JSON definition
}
}