
Build a blog post API with NodeJS and mongoose, using ChatGPT for project overview and features, cursor AI for coding, and Postman for testing.
Explore how the blog api application handles users, posts, and comments with features like registration, login, profile views, following, blocking, and post views, likes, and dislikes.
Create a Node.js blog api server by initializing npm, structuring folders (config, controllers, model, routes, utils) with express, configuring server.js, and running on a port with nodemon.
Connect your Node.js blog API to MongoDB Atlas by creating a free cluster, configuring a user and IP access, and wiring a dotenv-based connection via mongoose using async/await.
Connect to mongodb from vscode using the mongodb extension, paste the connection string from the .env file, and visualize the block-api-node database and its collections.
Learn data modeling for a blog API with Mongoose, defining users, posts, categories, and comments, mapping one-to-many and one-to-one relationships, and choosing between embedded and referenced data.
Model the user with a Mongoose schema, defining required fields (first name, last name, email, password), roles and activity status, and relationships to posts, followers, following, and profile views.
Learn to create a post schema with mongoose using ObjectId references to category and user models, including title, description, views, likes, dislikes, photo, and timestamps.
Model comments and categories for a blog API by defining post and user references, a message field, and timestamps, then compiling and exporting the schemas as models.
Create dummy routes for a blog api using a step-by-step mvc pattern, implementing users, posts, comments, and categories endpoints, and test them with the tenda client extension.
Test all endpoints for the blog API using thunder client, validating CRUD operations for users, posts, comments, and categories on localhost:9000 with API versioning, then MVC refactor.
Explore express routing by defining how endpoints, resources, and http methods map to client requests. Identify how get, post, put, patch, and delete manipulate resources, including dynamic IDs via req.params.
Refactor the server to use express routing, moving business logic into routers for users, posts, categories, and comments to simplify the server file and enable scalable endpoints via middleware.
Learn the mvc design pattern in nodejs api projects, clarifying model, view, and controller roles in a blog app and how to organize data and business logic within these layers.
Refactor a Node.js API by moving route logic into controllers, starting with a users controller for register, login, and profile. Learn to create, export, and wire controllers into routes.
Explore authentication and authorization from basics to advanced token-based methods, including low-level, encrypted, cookie-based, session-based, database-backed sessions, and JWT.
Explore how authentication works through a client–server–database flow, with a browser or postman as the client, a Node.js server, and MongoDB as the data source, handling login credentials.
Discover how JSON Web Tokens enable authentication in stateless HTTP servers by issuing a token after login, storing it in local storage, and sending it with requests to verify access.
Learn how Express middleware manipulates the request and response objects, enabling logic before and after the server. Use cases include authorization, login, error handling, rate limiting, validation, and business logic.
Learn how middleware acts as a security middleman between the client and server, validating login credentials, verifying accounts, and checking admin access before requests reach the server.
Explore Express middleware and how it uses request and response objects to control flow. Implement authorization, login, error handling, rate limiting, validation, and business logic with the next function.
Learn how middleware acts as a security middleman in an express server, enforcing login, account verification, and admin checks, and using next to pass the request along.
Build and test Express middleware that checks a user's login status using a user auth object with logged in and is admin properties, then call next to continue routing.
Learn how to configure express.json to parse the incoming payload, validate emails, and register a new user via the user model while planning password hashing later.
Implement login functionality by validating the user's email, checking the password, returning a uniform wrong credentials response, and avoiding saving the plain password.
Install and require bcrypt, generate a salt of 10 rounds, and hash the user’s password in the controller before saving the hashed value, then use bcrypt to verify credentials.
Verify the user by email, then compare the submitted password to the stored hash with bcrypt, returning the user on success or invalid login credentials on failure.
Protect the user profile endpoint by implementing authorization after authentication, retrieving the user by id from the route and validating access with token-based authentication through middleware.
Generate a token at login using a json web token, signing with the user id and a secret key, expire in seven days, and verify on every request.
Learn to extract a bearer token from the authorization header and reuse a header utility across routes to enforce authentication and prepare middleware protection for endpoints.
This lecture guides building a login middleware to protect routes by checking a token in the header, verifying it, and attaching the user to the request.
Implement token verification with json web token to secure endpoints, extract and attach the authenticated user to req.user, and update routes to rely on req.user for profile access.
Implement a global error handler in an Express app using a four-argument middleware, propagate errors with next, and return structured responses with status and message for Mongoose validation errors.
Implement a global error handler middleware and a reusable app error utility (function or class) with message, status code, and stack, wired into controllers for consistent responses.
Implement a not found 404 handler in a nodejs API by adding catch-all middleware that returns a JSON not-found message and logs the original URL.
Examine updates to the user model, including dynamic post count via virtual properties, profile photo uploads, and new fields like plan, awards, blocked status, and viewers.
Discover how to enable image uploads in an express app using motor with Cloud Neri, including configuring the cloud name, API key, and API secret.
Configure a Node.js blog api server to accept form data and file uploads with Cloudinary, using specific package versions, environment keys, and storage options for formats, folder, and transformations.
Create a profile photo upload endpoint using multer and cloud storage, wire a controller and authenticated route, handle a single profile field, and load env vars with dotenv.
Authenticate the login user via token, locate the user, and verify they are not blocked. Upload the profile photo and update the user document in MongoDB.
Implement a profile viewers controller that records each viewer by adding their id to the original user's viewers array, secured behind authentication, via a profile viewers endpoint.
Build a follow and unfollow feature via a controller that updates the user’s followers and following arrays by adding or removing IDs.
Implement the follow user controller in the nodejs blog api by mounting a get route, validating auth, updating followers and following arrays, and returning a success response.
Learn to implement an unfollow user controller by duplicating the follow logic, locate both users by id, update the followers and following arrays, save changes, and return a success message.
Block user controller demonstrates one-directional blocking by updating a blocker’s blocked array, preventing the blocked user’s posts, with checks for existing blocks and clear success or error messages.
Implement an unblock user feature in a nodejs api project, removing the target from the blocker's blocked array via a protected endpoint with token authorization.
Enable an admin-only endpoint to block a user by id, toggling the is blocked flag to true and saving the change, with error handling for missing users.
Learn how to implement an admin-only middleware in a Node.js API by verifying the token, locating the user in the database, and checking user.is_admin to guard admin routes.
Learn how an admin unblocks a user by duplicating the blocking logic, updating the is_blocked flag, and wiring admin unblock routes in a Node.js blog API.
Learn how to use Mongoose virtual properties to derive a user's full name from first and last names (not stored in the database), expose it on fetch with toJSON.
Learn to create a user full name initials virtual property in a Node.js blog API by deriving initials from first name and last name.
Learn to implement a post count virtual property on a user in a nodejs blog api by using posts.length to compute and expose user.postCount in requests.
Add dynamic followers, following, viewers, and blocks counts to the user model and compute the last post created to assign a silver or gold award based on post activity.
Nodejs API Complete Guide is your one stop solution to learning how to build a complete API using NodeJs, ExpressJs and MongoDB. In this course, we'll first start off by install the dependencies that we'll need for our project. Next, we'll set up our Express server and create our first API endpoint. From there, we'll connect to our MongoDB database and start creating blog posts. Finally, we'll finish up by creating an authentication system so that users can login and access their own blog posts. By the end of this course, you'll have a complete understanding of how to build a NodeJs API and will be able to build your own
This course is a complete guide to building a Nodejs API from scratch. We will first set up our development environment and then dive right into coding our API. We will build a complete blog application API, including routes, controllers, models, authentication, and file uploads. By the end of this course, you will have a strong understanding of how to build robust Nodejs APIs.
You don't need any previous experience in API development as this course is designed to take you through step by step
We will a explained in an easy to understand way with step by step instructions, video tutorials, and live examples. This is a hands-on course, where you get immediate access to every lesson,