In this video, Emmanuel Henri starts the MongoDB database you installed previously, then adds a connection to it with Mongoose. Finally, he starts the testing tool to make sure the MongoDB database is indeed running.
- [Instructor] Okay, so now we are ready…to set up our database inside of our API,…so let's get to it.…So the first thing I want you to do…is go inside of your editor, and then…open up the index.js file.…And the first thing we'll do is…import mongoose from 'mongoose';…like so, and then we'll import bodyParser.…And FYI, body Parser, what does it do?…A lot of people are always questioning this.…Basically it allows us to send objects or data…through HDT post, through our database.…
So this will allow us to get the right data…and post it to our database.…Or API.…Let's do from 'body-parser'.…Okay, so just below line seven,…so return here.…We'll create our mongoose connection.…So let's do a little comment here…so you understand what this is.…Mongoose connection.…
And let's do mongoose, and first we'll create a Promise.…So we can make sure that we make a connection…and we don't wait for it.…And then do the mongoose connection.…So connect, like so.…And FYI, the URL that I'm going to put here…is the local URL, but if you had an external server…
- Setting up a project and a server
- Setting up a database and schema
- Creating POST, GET, PUT, and DELETE endpoints
- Serving files
Skill Level Intermediate
Node.js: Extend and Maintain Applicationswith Daniel Khan3h 35m Intermediate
Node.js: Build Your First Microservicewith Daniel Khan2h 9m Intermediate
1. Setting Up
2. Initial Server Build
3. CRUD Operations
4. Other API Options
Static files serving3m 16s
Next steps1m 1s
- 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.