In this video, learn how to leverage the data we imported and have one of the endpoints return the data.
- [Instructor] Being able to return data…from a database or data loaded into our server…is just about every server's purpose.…Let's work on something like this.…So go back to S code and then open the index.js…and then let's go in the app.get meta.…So right now what we're doing is basically…calling on to this path,…and whenever we call on to this path,…we are responding with a get request blah, blah, blah.…So we want to change this.…Let's change this with an actual response with data.…
And the way you do this, and let me just delete that,…so delete line number 8,…and the way you do this is very, very simple.…So if we had a Mongo database or SQL database…that's connected to the server,…what we would do first is basically call on to that server…and get the data, so like we've done here.…We've imported the data, but let's say, for example,…we had a Mongo DB connected.…We would need to get the data first,…and return it, and then send it to our client.…
So, we would do something like so:…So response JSON and then path whatever is the data…
- Creating a basic data endpoint
- Routing with Express
- Adding a static route for file serving
- Basic middleware with Express
- Built-in middleware and error-handling middleware
- Debugging in an Express application
- Security best practices with Express
Skill Level Beginner
1. Setting Up Express
2. Getting Started
3. Routing with Express
4. Middleware with Express
5. Advanced Topics in Express
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.