Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed REST APIs with Express!
You have completed REST APIs with Express!
Preview
Learn how to set up an Express route that provides an endpoint to get the list of quotes and a specific quote.
Data snippet
const data = {
quotes: [
{
id: 8721,
quote: "We must accept finite disappointment, but we must never lose infinite hope.",
author: "Martin Luther King"
},
{
id: 5779,
quote: "Use what you’ve been through as fuel, believe in yourself and be unstoppable!",
author: "Yvonne Pierre"
},
{
id: 3406,
quote: "To succeed, you have to do something and be very bad at it for a while. You have to look bad before you can look really good.",
author: "Barbara DeAngelis"
}
]
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
named data, which contains an object
with an array of quote objects.
0:00
If you've been following along with me,
you can copy and
0:03
paste this data into your project
from the teacher's notes.
0:06
Ideally we wouldn't want to keep our data
in this file with all the rest of our
0:08
code, we'd wanna use
some kind of data store.
0:12
This is most often going to be a database,
like PostgreSQL or MongoDB, but it
0:15
could also be a JSON file or in our case
here just a regular JavaScript object.
0:20
For now this JavaScript object is going
to serve as our data store, meaning we're
0:25
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up