Learn The MERN Stack - Express & MongoDB Rest API
Traversy Media
View ChannelAbout
Traversy Media features the best online web development and programming tutorials for all of the latest web technologies from the building blocks of HTML, CSS & JavaScript to frontend frameworks like React and Vue to backend technologies like Node.js, Python and PHP
Latest Posts
Video Description
In this video, we will create a RESTful API from scratch with Node.js, Express, MongoDB and Mongoose. 💻 Code: https://github.com/bradtraversy/mern-tutorial 👇 Full React 2022 Course With $12.99 promo: https://www.udemy.com/course/react-front-to-back-2022/?couponCode=REACTF2BFEB2022 👇 Website & Courses: https://traversymedia.com 💖 Show Support Patreon: https://www.patreon.com/traversymedia PayPal: https://paypal.me/traversymedia 👇 Follow Me On Social Media: Twitter: https://twitter.com/traversymedia Instagram: https://www.instagram.com/traversymedia Linkedin: https://www.linkedin.com/in/bradtraversy Timestamps: 0:00 - Intro 2:41 - How a REST API Works 6:13 - Set up the Project Folder 10:11 - Initialize GIT & Commit 10:46 - Basic Express Server 12:12 - Environment Variables 13:28 - First Route 15:51 - Routes File 20:34 - Creating a Controller 24:44 - Connecting Controller Functions 26:40 - Accepting Body Data 28:41 - Error & Exception Handling 34:21 - Express Async Handler 36:46 - Create MongoDB Database 42:02 - Connect with Mongoose 47:02 - Create a Model 49:35 - Get Goals 51:30 - Create Goal 52:56 - Update Goal 55:22 - Delete Goal
Upgrade Your Coding
AI-recommended products based on this video

MOSISO Laptop Case 13 inch, 13 inch Laptop Sleeve Bag Compatible with MacBook Air 13 M4 M3 M2 M1 2025-2018 / Pro 13 M2 M1 2025-2016, Neoprene Computer Sleeve Bag with Small Case, Space Gray Global Recycled Standard

MOSISO 360 Protective Laptop Bag 15 inch, 15 inch Computer Shoulder Bag Compatible with MacBook Air 15 M4 M3 M2 2025-2023, Dell XPS 15, Side Open Messenger Case &4 Zipper Pockets&Handle, Black Global Recycled Standard

MOSISO 13-14 inch Laptop Case, 13.3 inch Puffy Laptop Sleeve Compatible with MacBook Air 13 13.6 M4 M3 M2 M1/Pro 13/Pro 14,HP,Dell,ASUS, Lenovo, Polyester Horizontal Bag with Small Case, Rose Red Global Recycled Standard

EooCoo Case Compatible with MacBook Air 13 inch M4 M3 M2 2025-2022 A3240 A3113 A2681, Plastic Hard Case & TPU Keyboard Skin & Screen Protector for Laptop Air 13.6 inch - Crystal Clear Global Recycled Standard

Laptop Sleeve Case 11–14 Inch MacBook Air MacBook Pro Surface Laptop Dell XPS 13 HP Envy Pavilion Lenovo Yoga Slim IdeaPad Acer Swift Chromebook Samsung Galaxy Book Shockproof Leather Bag Colour Blue

Gumdrop ProTech Case for Dell New XPS 13 Plus 9320 Laptop- Slim Lightweight Case with Energy Displacement Protection, Non-Skid Rubber Feet and Frosted Exterior for Bumps and Drops (Black)

65W 45W USB C Laptop Charger Compatible with Dell Latitude 5420 5430 5520 5530 7340 7430 Inspiron 14 16 XPS 13 Chromebook 3100 Dell Computer Type C Fast Charging AC Adapter Power Cord

45W 65W AC Adapter Laptop Charger for Dell Inspiron 15 14 13 17 3000 5000 7000 Series 5558 5559 Charger Latitude E6440 E6430 3520 3420 XPS 13 14 9333 9350 Notebook Dell Computer Power Supply Cord

100W 90W USB-C Charger Type-C Adapter for Lenovo Thinkpad Carbon x1 5th 6th Gen, IdeaPad 13" 720 Y400 Y500 P580 P500, Yoga 370 X280 X390 910 920 Power Cord GX20M33579 4X20M26268

Anker 332 USB-C Hub (5-in-1) with 4K HDMI Display, 5Gbps - and 2 5Gbps USB-A Data Ports and for MacBook Pro, MacBook Air, Dell XPS, Lenovo Thinkpad, HP Laptops and More

Dell 24 Monitor - SE2425HM - 23.8-inch Full HD (1920x1080) 16:9 100Hz Display, IPS Panel, 16.70 Million Colors, Anti-Glare, 1 HDMI / 1 VGA Port, TÜV Rheinland 3-Star*, Comfortview Plus - Black

Dell S2425HS Monitor - 23.8 Inch, FHD (1920x1080) Display, 100Hz Refresh Rate 1500:1 Contrast Ratio, TÜV Rheinland Eye Comfort 4 Star, Integrated 2x5W Speaker, Height/Tilt/Swivel/Pivot - Ash White

USB C Docking Station Dual Monitor for Dell Hp,15-in-1 Laptop Docking Station 3 Monitors USB C Hub with Dual 4K HDMI,8K DP,Button,PD Charging,Ethernet,6 USB A&C,SD/TF, Audio USB-C Multiport Adapter

Dell 24 Monitor - P2425H EPEAT

Apple 2025 MacBook Air 13-inch Laptop with M4 chip: Built for Apple Intelligence, 16GB Unified Memory, 256GB SSD Storage, Touch ID; Sky Blue - English Keyboard

Air Tracker Tags 4 Pack, Bluetooth Tracker & Item Locator Work with Apple Find My (iOS Only), Replaceable Battery, Waterproof Smart Tag for Keys, Wallet, Suitcases

Air Tracker Tags-4 Pack: Smart Bluetooth Tracker, Item Finder Works with Apple Find My (iOS Only) App, Trakcer Tag Locator for Keys, Luggage, Satchel, Backpack etc. (Not for Android Devices)

HATALKIN Case Compatible with Apple AirTags Case Keychain Air tag Holder Air Tag Key Ring Cases Air Tags Protective Cover Airtag Key Chain Loop Holders Silicone for Luggage Dog Cat Pet Collar 4 Pack

90W AC Power Adapter for Dell OptiPlex 3000 5000 7000 9020 Series Micro Desktop Inspiron 20" 22" 24" 27" AIO Desktop, Inspiron 15 16 17 14 13 3000 5000 7000 Series Laptop Charger

Dell Dock WD19S USB-C 180W Power Delivery

65W USB C Laptop Charger for Dell Latitude 5540 5420 5520 5430 5320 7275 7440 e5440 5450 7430 7400 5550 5530 9410 9510 XPS 13 15 Chromebook Fast Charging for Dell Computer Type C AC Adapter Power Cord

65W 45W USB C Laptop Charger Compatible with Dell Latitude 5420 5430 5520 5530 7340 7430 Inspiron 14 16 XPS 13 Chromebook 3100 Dell Computer Type C Fast Charging AC Adapter Power Cord

Samsung 990 EVO Plus - 4TB PCIe Gen4. X4, Gen5. X2 NVMe 2.0 - M.2 Internal SSD, Speed Up to 7,250 MBs, Upgrade Storage for PC-Laptops, HMB Technology and Intelligent Turbowrite (MZ-V9S4T0B/AM)
![SAMSUNG 990 PRO SSD 4TB PCIe Gen4 NVMe M.2 Internal Solid State Hard Drive, Up to 7,450MB/s, Heat Control, Direct Storage and Memory Expansion, MZ-V9P4T0B/AM [Canada Version]](https://m.media-amazon.com/images/I/81WuG6lQuDL._AC_UL960_FMwebp_QL65_.jpg)
SAMSUNG 990 PRO SSD 4TB PCIe Gen4 NVMe M.2 Internal Solid State Hard Drive, Up to 7,450MB/s, Heat Control, Direct Storage and Memory Expansion, MZ-V9P4T0B/AM [Canada Version]
![Samsung 9100 PRO Series - 4TB PCIe 5.0 x4, NVMe 2.0, M.2 Internal SSD, Up to 14,800MB/s, Fast Speed, Thermal Contorl, MZ-VAP4T0B/AM [Canada Version]](https://m.media-amazon.com/images/I/71qygJIcKnL._AC_UL960_FMwebp_QL65_.jpg)
Samsung 9100 PRO Series - 4TB PCIe 5.0 x4, NVMe 2.0, M.2 Internal SSD, Up to 14,800MB/s, Fast Speed, Thermal Contorl, MZ-VAP4T0B/AM [Canada Version]
![SAMSUNG 870 EVO SATA SSD 500GB 2.5” Internal Solid State Drive, Upgrade PC or Laptop Memory and Storage for IT Pros, Creators, Everyday Users, MZ-77E500B/AM [Canada Version]](https://m.media-amazon.com/images/I/911ujeCkGfL._AC_UL960_FMwebp_QL65_.jpg)
SAMSUNG 870 EVO SATA SSD 500GB 2.5” Internal Solid State Drive, Upgrade PC or Laptop Memory and Storage for IT Pros, Creators, Everyday Users, MZ-77E500B/AM [Canada Version]




