Learn how to establish a database connection for Node.js application.
- In this section, we're going to be connecting … to our database and start working with some actual data … for our application. … So the first thing that we're going to want to do … is connect to our Mongo database from our server. … So first open a new terminal window … and run an npm install mongoose. … That's the package that we're going to be using … to interact with the database. … Then go over to your config file and environment file … and let's set a URL for our database. … So right underneath this variable, … go ahead and assign a db URL variable. … And so for our Mongo database it's going to be … mongo://localhost … and then the port that you're listening on … and then followed by the database name. … Now you should have an instance of Mongo to be running. … And if you look right here, it tells you … that I'm listening on port 27017. … That's the default port when you run it. … So you want to make sure that matches, … otherwise you won't be able to connect. … And then your database name can be anything. …
- Single-page applications and Vue.js
- Preparing your development environment
- Creating a Vue.js application
- Using the Vue.js router
- Building a RESTful back-end API with Node.js and Express.js
- Connecting to MongoDB
- Validating and managing a user session
- Connecting Vue.js to a back-end server
Skill Level Intermediate
1. Getting to Know the MEVN Stack
2. Preparing Your Development Environment
3. Vue.js Core Concepts
4. Building a RESTful Back-End API with Node.js and Express.js
Check HTTP status codes3m 17s
5. Connecting Your Application to MongoDB
6. User Authentication, JWTs, and Session Management
7. Finalizing Your Application
- 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.