Simple mock endpoint with autogenerated / configurable return values.
This project aims to fake your reals endpoints instead of waiting another unfinish backend dev.
The idea is to configure the return values in body request. Watether the type and the route.
The API doesn't matter the HTTP method used and the nested route called.
Online endpoint available at jmgen.herokuapp.com/
Powered by Node-restify and ChanceJS
- The API doesn't matter the HTTP method used and the nested route called :
GET
===PUT
- Create random object with or without parameters
- Use a full mapped ChanceJS lib
- Clone project locally
- Do
npm install
with version of node installed > 13 - Run in debug with
npm run serve
or start a server withnpm start
You can go to whatever the route you want. So, /
will get the same result as /test
or /test/deeped.with.extension
.
The important data will be queryUrl params and body datas (for POST).
Important note about the merging between query url and body, body will be arbitrary prior (technicaly Object.assign(query, body)
). Feel free to submit a request or a PR if you have relevant arguments.
Most of features are shown as sample. For further documentation refer to ChanceJS.
For list use _length=[listsize]
For object use {property: value}
. Value can be a ChanceJs function like name. So {login: 'name'}
result to a {login: 'randomName'}
{}
{
"id": 2263426013331456
}
- Local test:
GET localhost:8080
- Online demo:
GET jmgen.herokuapp.com
{
"_length": 3
}
[
{ "id": 4669038997274624 },
{ "id": 2258162581241856 },
{ "id": 3514527639404544 }
]
{
"name": "name",
"birthday": "birthday",
"city": "city",
"genre": "male"
}
{
"name": "Nell Pittman",
"date": "1972-12-25T15:53:38.118Z",
"cite": "Seecivoc",
"genre": "male"
}
- Local test: localhost:8080/?name=name&date=birthday&cite=city&genre=male
- Online demo: jmgen.herokuapp.com/?name=name&date=birthday&cite=city&genre=male
{
"_length": 3,
"name": "name",
"birthday": "birthday",
"city": "city",
"genre": "male"
}
[
{
"name": "Alberta Ruiz",
"date": "1982-02-27T23:42:45.881Z",
"city": "Bizhugge",
"genre": "male"
},
{
"name": "Sean Dennis",
"date": "1953-07-16T23:43:14.530Z",
"city": "Lufrirno",
"genre": "male"
},
{
"name": "Nancy Stevenson",
"date": "1976-09-01T10:47:20.845Z",
"city": "Takufe",
"genre": "male"
}
]
- Local test:
GET localhost:8080/?_length=3&name=name&date=birthday&city=city&genre=male
- Online demo:
GET jmgen.herokuapp.com/?_length=3&name=name&date=birthday&city=city&genre=male
- Create list with eight in a range
- Add Sample element (Get User ...)
- Pas url for keywords (with elements and verbs like "list")
- Insert a config file on startup (json-server like)