Chapter 9

Riding on the Express Train

IN THIS CHAPTER

Bullet Getting started with Express

Bullet Making server-side routes

Bullet Using and creating middleware

Bullet Creating an Express API server

Bullet Using a template engine to serve views

Bullet Benefiting from the express application generator

“The speed of light sucks.”

—JOHN CARMACK

Express is the most popular Node.js web application framework. Whether you're building an API server or a web application server with Node.js, Express greatly simplifies working with HTTP, templates, and routes.

In this chapter, I show you how to start working with Express and how to use Express to create server-side web applications.

Installing Express

To install Express, you can use an existing Node.js package or create a new one (using npm init) and then enter npm install express.

The examples in this chapter use ES Module syntax, so you need to add "type":"module" to your package.json ...

Get JavaScript All-in-One For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.