Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Aweller95/data-mock-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

data-mock-api

The data-mock API generates an array of objects which match a provided schema.

How to use

data-mock works by providing a schema and a quantity to the POST endpoint /generate.

API available at: https://data-mock-api.herokuapp.com.

Supported data types

  • string - currently returns a single, random word
  • email - returns a randomly generated, fake email address
  • number - returns a number between 1 - 100
  • date - 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
        },
    ]
}

Local development

This project uses npm to handle dependencies.

run npm install to install dependencies

Scripts

  • start: starts the app on port 3000.

About

A simple API that returns JSON of any shape. Available at: https://data-mock-api.herokuapp.com

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •