Skip to content

stevepaulo/rando-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rando-api

Random API response generator

Installation

  1. npm i
  2. npm start

rando-api has all the necessary pieces to be deployed to Heroku and shouldn't need any configuration to do so.

Usage

The API provides four endpoints:

/api/health

Responds with "OK" if the API is running.

/api/v1/products

Responds with a relatively-predictable JSON payload.

  • Has a root products array
  • products array has between 1 and 10 objects.
  • Every object has the same property keys:
    • name String
    • origin String
    • price Number
    • quantity Number
    • inStock Boolean
    • availableColors Array
  • Every object property value is randomized. Strings are unique among the other response members.

/api/v2/products

Responds with an unpredictable JSON payload.

  • Has a root products array
  • products array has between 1 and 10 objects.
  • Every object has at least some, but not necessarily all of the following property keys:
    • name String
    • origin String
    • price Number
    • quantity Number
    • inStock Boolean
    • availableColors Array
  • Every object property value is randomized. Strings are unique among the other response members.

/api/v3/products

Responds with an unpredictable, nested JSON payload.

  • Has a root products array
  • products array has between 1 and 10 objects.
  • Every object has at least some, but not necessarily all of the following property keys:
    • name String
    • origin String
    • price Number
    • quantity Number
    • inStock Boolean
    • availableColors Array
  • Every object may or may not have a relatedProducts array, which mimics the root products array in all ways.
  • Every object in a relatedProducts array may or may not itself have a relatedProducts array.
    • The rabbit hole doesn't go further than that. Maximum three total levels.
  • Every object property value is randomized. Strings are unique among the other response members at the same nesting level.

Testing

  1. npm test

About

Random API response generator

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors