
Discover how Node.js lets you run JavaScript on the server to build scalable, event-driven web apps with Express and MongoDB, enabling code sharing between browser and server.
Install Node.js by downloading the recommended version for your operating system, complete the installer, and verify the installation by running node -v and npm -v in the terminal.
Create and run Node.js server using the http module, requiring packages and a callback to handle requests and responses, then listen on port 3000 to complete the request–response cycle.
Learn to route requests by URL with an if-else in the callback, returning the home, about, or contact pages, or a 404 not found with a 200 status for success.
Learn to respond with html by building home, about, contact, and not found pages using the filesystem module, and explore the request-response cycle with express.
Initialize a project with npm init, install express via npm install express, and learn how middleware, routing, and dependencies appear in package.json and node_modules.
Discover how Express streamlines handling requests with routing, and using the request and response objects to handle get and post requests, returning html to the browser.
Learn how to write asynchronous code in Node.js using callback functions to run tasks in parallel, handle concurrent requests, and perform database queries without blocking.
Learn to serve the about and contact HTML files with Express by mapping routes, and understand that get retrieves homepage, about page, and contact pages.
Learn to serve static assets with Express using express.static, configure a public directory, and reference css and js from html while managing dependencies with npm.
Download a blog template from Start Bootstrap, extract and move it to the project folder, install Express, create index.js with Express, and start the server on port 4000.
Install nodemon to automatically restart the server on file changes, and configure npm install with --save or --save-dev, then set up npm start to run the watch script.
Register a public folder for serving static files with Express and move html, css, images, and vendor assets into the public directory.
Register a get route to serve HTML pages from a root pages directory, moving files from public and updating links. Learn how templating engines reduce repetitive navigation changes for scalability.
Refactor static pages into dynamic templates using a templating engine to share layouts and navigation across pages. Explore engines like Handlebars, Pug, and EJS with Express.
Learn to refactor repetitive web page code by extracting common elements—navigation, header, footer, and scripts—into reusable layout files and including them in pages with a templating engine.
Explore how MongoDB, a popular NoSQL database, stores data as collections and documents, contrasts it with relational databases, and powers scalable app backends.
Install and connect to MongoDB with Mongoose, then define a schema and create a model that represents a collection. Learn Mongoose's automatic pluralization and how to export the model.
Explore Mongoose CRUD on MongoDB by connecting to the database and creating or deleting posts in a test script, using the post model with title and body.
Learn to read data from MongoDB with Mongoose by using find({}) to fetch all posts, and apply title or _id filters with query criteria.
Discover how to update and delete records in MongoDB with Mongoose, including selecting the correct document and updating fields like the title. Visualize data with MongoDB Compass.
Apply Mongo DB to our project by building a create new post view, wiring a form to post data to the post store, and handling request bodies with Express.
Save posts to our database, create a new post in the post collection using the request body, then switch from callbacks to async/await for clearer, more readable code.
Display a list of blog posts by using find to retrieve all posts, assign them to a posts variable, and render the data to the homepage.
Render dynamic blog posts in the home view by looping the post array with the eggs templating engine, displaying each title and body.
Set up an express route with a dynamic post id, fetch the post by id with async/await, and render its title and body on a dedicated page.
Add username and date fields to the post schema with a date default, update the post model, and render posts on the homepage and pages using Express middleware and MongoDB.
Install the express-fileupload package, add an image input to the post form, and move the uploaded image to the public/image directory to display it.
Learn how to upload a user image, save its file path in a blog post, and display the image in the post view using Node.js, Express, and MongoBD.
Explore how express middleware runs sequentially after requests, featuring logging, authentication, and json pathing, and learn to create custom middleware with next() to control the final response.
Implement validation middleware in node.js express to verify post fields, prevent errors, and ensure data validity, then apply it to the create post route to redirect if fields are missing.
Refactor a monolithic Node.js app into the model-view-controller pattern by creating a controller layer and migrating request handlers, improving organization and scalability.
Refactor the code by moving validation into a dedicated middleware directory, wire it with requires, and implement the controllers under the model view controller pattern to keep index.js clean.
Implement a user registration flow by creating a register view and a form for username and password, posting to /users/register, and adding a navigation link to register.
Develop a user model in the models folder with username and password fields, wire a register route and controller, and handle a post to /users/register from the register view.
Create a registration controller that uses a Mongoose user model to store new accounts, and implement a pre-save hook to hash passwords with bcrypt before saving to MongoDB.
Enforce data integrity with Mongoose validation in a user schema by marking fields as required and unique, handle validation errors, and provide user feedback on registration.
Create a login page aligned with the register flow, update the login controller and routes, render the login view, and place the login link before register for UI clarity.
Implement a login process in a Node.js Express app by validating input, retrieving user by username, comparing the password to the stored hash, and redirecting to home page on success.
In this course, we take you on a fun, hands-on and pragmatic journey to learning Node.js, Express and MongoDB development. You'll start building your first Node.js app within minutes. Every chapter is written in a bite-sized manner and straight to the point as I don’t want to waste your time (and most certainly mine) on the content you don't need. In the end, you will have the skills to create a blog app and deploy it to the Internet.
In this course, we will cover:
Chapter 1: Introduction
Chapter 2: Introduction to npm & Express
Chapter 3: Beginning our Blog Project
Chapter 4: Templating Engines
Chapter 5: Introduction to MongoDB
Chapter 6: Applying MongoDB to our Project
Chapter 7: Uploading an Image with Express
Chapter 8: Introduction to Express Middleware
Chapter 9: Refactoring to MVC
Chapter 10: User Registration
Chapter 11: User Authentication with Express Sessions
Chapter 12: Showing Validation Errors
Chapter 13: Relating Post Collection with User Collection
Chapter 14: Adding a WYSIWYG Editor
Chapter 15: Using MongoDB Atlas
Chapter 16: Deploying Web Apps on Heroku
The goal of this course is to teach you Node.js, Express and MongoDB development in a manageable way without overwhelming you. We focus only on the essentials and cover the material in a hands-on practice manner for you to code along.
About the Reader
No previous knowledge on Node.js development required, but you should have basic programming knowledge.
About the Author
Greg Lim is a technologist and author of several programming books. Greg has many years in teaching programming in tertiary institutions and he places special emphasis on learning by doing.