Essential CSS
JavaScript Roadmap
Learn JavaScript
Mastering Web Typography
Practical Astro
Understanding Async JS
Unorthodox Tailwind
API Masterclass
Build and Deploy
The Beginner Freelancer
Real World Node
Profile Billing Logout
Real World Node
Lesson Plan
  1. Workshop Recordings
    1. ๐Ÿ“น Understanding Node and Express
    2. ๐Ÿ“น Creating a traditional server
    3. ๐Ÿ“น Building API servers
    4. ๐Ÿ“น Create, Read, Update, and Delete APIs with real databases
    5. ๐Ÿ“น Handling user flows
    6. ๐Ÿ“น Testing your app and database with Vitest
    7. ๐Ÿ“น Testing Middlewares and APIs โ€” including Mocking
    8. ๐Ÿ“น Changing and resetting passwords

๐Ÿ“น Create, Read, Update, and Delete APIs with real databases

1m:8s
14m:45s

This is where we officially begin to make the Rest APIs youโ€™re creating useful.

You will learn to:

  • Setup Mongoose (a better way to manage MongoDB) in your project.
  • Create users and save them to the database
  • Use your Rest APIs to create, read, update, and delete users (CRUD).

Weโ€™re using real databases here because all useful Rest APIs talk to databases. If they donโ€™t, your information will not be saved, and in most instances, the connection will be redundant.

Source Code

Hereโ€™s a link to the Github Repository.

Timestamps

  • 0:00 Introduction to databases
  • 1:30 Recap from previous session
  • 5:30 MongDB vs Mongoose
  • 7:00 Creating Mongoose models and schemas
  • 11:30 Adding Data into into the models
  • 14:00 Adding data in a route
  • 17:30 Generic structure of an API
  • 22:07 Using Thunder Client (alternative to postman) to send requests
  • 24:00 Creating a user
  • 29:20 Cleaning up Mongoose objects before sending them to the frontend
  • 31:11 Getting users
  • 38:30 Converting a string into an Mongoose object
  • 41:30 Recommended file structure for an Express project
  • 42:00 Creating a service layer
  • 51:50 Small defensive coding
  • 53:15 Setting correct error status
  • 56:15 Updating a user
  • 1:04:00 Deleting a user