Connect Mongodb Atlas to nodejs and Express Server

  Рет қаралды 8,014

Red Eye Media

Red Eye Media

Күн бұрын

Learn how to connect Mongodb Atlas to a Node Express backend.
We will be doing everything from scratch, making our free cluster and database in the cloud. Then we configure database access and make a user to access it. The way we connect with Mongodb Atlas is through a connection string, that we store in a .env file locally in our backend project.
When that is done we make our node express server with two endpoints. One GET route for getting all the entities (customers) and creating a new one though a POST endpoint. Inside our project we also make a schema of the customer object we will be working with.
To query our backend we use Postman, which is a very useful tool for this, and you can download it here:
www.postman.com/downloads/ 💌
Timecodes
0:00​ - Intro
0:30 - creating cluster
1:24 - creating user
02:30 - creating database
03:50 - Network access
04:45 - connection string
08:00 - environmental file
11:10 - app.js file
15:15 - mongoose
18:48 - customer schema
23:38 - POST endpoint
28:37 - POST in Postman
31:35 - GET endpoint
33:30 - Complete
Complete code on Github:
github.com/Polkagris/connect_... 🐱
How to get the code without using the terminal:
1. Go to the Github link
2. Click on the green Code-button
3. Click Download ZIP
4. Extract and open the folder in your preferred code editor (I'm using visual studio code, download link below)
5. To see the game in action, just open the index.html file in you browser
Read my blog on Dev.to - dev.to/redeyemedia 🧐
New videos every week!

Пікірлер: 10
@DeanForant
@DeanForant 2 жыл бұрын
Great video. One Thing to note though. Mongoose Version 6 no longer supports executing the same query object twice. The current code to get customerlist will error on any v6 installs of Mongoose. The workaround I did was as follows. app.get('/customerlist', async (req,res) => { const customers = await Customer.find({}); console.log('Customer from db: ', customers); res.send(customers); }); Once I made these changes I was able to show all the customers.
@inspiringstories143
@inspiringstories143 Жыл бұрын
Thanks Bro It is very helpful for specially me🙏🙏
@TopSecretBase
@TopSecretBase 2 жыл бұрын
Thanks, this was very beneficial.
@gregorysampson6715
@gregorysampson6715 2 жыл бұрын
thank you for this video, helped me so much
@abdullahyounas6470
@abdullahyounas6470 2 жыл бұрын
Such a Jewel
@SuperSayiyajin
@SuperSayiyajin 2 жыл бұрын
Thanks a lot...
@Allah_Rakha
@Allah_Rakha Ай бұрын
you have not mentioned collection name anywhere. how did it work, please help?
@eust4y
@eust4y 2 жыл бұрын
thank you
@jesvinjohnson1656
@jesvinjohnson1656 2 жыл бұрын
Nice video! Could you also guide how to connect multiple dbs from a mongodb atlas cluster.
@ahmadsetiadi8509
@ahmadsetiadi8509 2 жыл бұрын
spill your vscode extension and setting please
Pass data between React UI and MongoDB Atlas | MERN Tutorial
36:50
Learn Node.js & Express with Project in 2 Hours
1:42:53
Dipesh Malvia
Рет қаралды 487 М.
1 or 2?🐄
00:12
Kan Andrey
Рет қаралды 27 МЛН
He sees meat everywhere 😄🥩
00:11
AngLova
Рет қаралды 9 МЛН
МАМА И STANDOFF 2 😳 !FAKE GUN! #shorts
00:34
INNA SERG
Рет қаралды 4,1 МЛН
Getting Started with MongoDB Atlas - A Modern Database!
19:56
Connect to MongoDB Atlas through NodeJS | INFY TECH
8:52
INFY TECH
Рет қаралды 35 М.
MongoDB + Mongoose + Node.js Crash Course | CRUD and fundamentals of MongoDB
1:09:21
Complete CRUD Application with Node, Express & MongoDB
2:39:38
Daily Tuition
Рет қаралды 652 М.
The Easiest Way to Explore your MongoDB Data
5:45
Visual Studio Code
Рет қаралды 16 М.