Skip to content

Instantly share code, notes, and snippets.

@mwitz8
Created January 19, 2021 17:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mwitz8/2c2cd73d85ab939aa1986c1e47acd745 to your computer and use it in GitHub Desktop.
API Call for Sample Data
app.get('/api/products', (req, res) => {
database.readAllProducts((results) => {
res.send(results);
});
})
[
{
"_id": "6000f8b6c5da4323a102cfc2",
"name": "Tasty Wooden Bacon",
"imageUrl": "http://placeimg.com/640/480/nature",
"__v": 0
},
{
"_id": "6000f8b6c5da4323a102cfc3",
"name": "Awesome Frozen Shoes",
"imageUrl": "http://placeimg.com/640/480/nature",
"__v": 0
},
{
"_id": "6000f8b6c5da4323a102cfc4",
"name": "Handmade Soft Pizza",
"imageUrl": "http://placeimg.com/640/480/nature",
"__v": 0
},
{
"_id": "6000f8b6c5da4323a102cfc5",
"name": "Handcrafted Concrete Ball",
"imageUrl": "http://placeimg.com/640/480/nature",
"__v": 0
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment