Building a Website with Node.js and Express.js

Building a Website with Node.js and Express.js

3h 11mBeginner2024-11-14

Authors

Daniel Khan

Daniel Khan

Technology Lead, Developer, Application Architect

Course details

Node.js is a major platform for the web, used by companies like Uber, Netflix, and Intuit. Express.js is a fast, minimalist framework that sits on top of Node.js and allows you to build powerful single- and multi-page web applications and websites. In this course, instructor Daniel Khan shows how to build a realistic and robust website with these technologies. Learn how to build a basic application in minutes, transform HTML into dynamic pages, leverage template engines to modularize code, add routing and business logic, handle errors, store form data, and create API endpoints for single-page applications. Along the way, Daniel helps you pick up bits and pieces about Express.js and improve your overall knowledge of how to work effectively with Node.js.

Learning objectives
Creating a basic Express.js application
Serving HTML pages and static content
Creating routes
Using templates
Handling errors in Express.js
Handling POST requests
Storing form data

Skills covered

Express.jsNode.jsJavaScript FrameworksBack-End Web DevelopmentProjectWeb DevelopmentOpen Source

Concepts

Introduction

  • Dynamic websites with Node and Express
  • What you should know
  • Using the exercise files and GitHub
  • Setting up your development environment

Building a Basic Express Application

  • Create an Express server in three minutes
  • Building from a HTML page or template
  • Serving HTML pages and static content
  • Setting up ESLint and Prettier
  • Setting up nodemon

Template Engines

  • Template engines and Express
  • Getting to know the EJS template engine
  • Rendering the index page with EJS

Express Routes and Middleware

  • Express middleware and routes
  • Modular routes with express.Router
  • Creating routes for all subpages
  • Add business logic
  • Add a session management middleware

Professional Templating with Express

  • Create a site-wide layout
  • Using partials with EJS
  • Template variables in more detail
  • Looping through lists in templates
  • Creating a list page
  • Using parameter routes
  • Challenge - Partials and lists
  • Solution - Partials and lists

Handling Errors Gracefully

  • How to handle errors in express
  • Creating an error page
  • Populating the error page

Handling Form Data

  • Creating a form template
  • Handling POST requests
  • Validating and sanitizing user input
  • Storing data

Creating APIs with Express

  • A little intro to REST APIs
  • Creating and testing an API endpoint
  • Add client side JavaScript
  • Updating the page from REST

Conclusion

  • Build on what you've learned
80,000 Toman