The data-mock API generates an array of objects which match a provided schema.
data-mock works by providing a schema and a quantity to the POST endpoint /generate.
API available at: https://data-mock-api.herokuapp.com.
string- currently returns a single, random wordemail- returns a randomly generated, fake email addressnumber- returns a number between 1 - 100date- returns a date, which will be the time of when the request is made
An example POST body:
{
"quantity": 2,
"schema": {
"firstName": "string",
"lastName": "string",
"email": "email",
"age": "number",
"birthday": "date",
"boolean": "boolean"
}
}returns:
{
"data": [
{
"firstName": "lorem",
"lastName": "ipsum",
"email": "[email protected]",
"age": 0,
"birthday": "2021-08-10T20:27:34.174Z",
"boolean": true
},
{
"firstName": "lorem",
"lastName": "ipsum",
"email": "[email protected]",
"age": 0,
"birthday": "2021-08-10T20:27:34.174Z",
"boolean": true
},
]
}This project uses npm to handle dependencies.
run npm install to install dependencies
start: starts the app on port3000.