rando-api
Random API response generator
Installation
npm inpm 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
productsarray productsarray has between 1 and 10 objects.- Every object has the same property keys:
nameStringoriginStringpriceNumberquantityNumberinStockBooleanavailableColorsArray
- 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
productsarray productsarray has between 1 and 10 objects.- Every object has at least some, but not necessarily all of the following property keys:
nameStringoriginStringpriceNumberquantityNumberinStockBooleanavailableColorsArray
- 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
productsarray productsarray has between 1 and 10 objects.- Every object has at least some, but not necessarily all of the following property keys:
nameStringoriginStringpriceNumberquantityNumberinStockBooleanavailableColorsArray
- Every object may or may not have a
relatedProductsarray, which mimics the rootproductsarray in all ways. - Every object in a
relatedProductsarray may or may not itself have arelatedProductsarray.- 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
npm test