🎓 A1Learner
🔍
0 of 50 lessons completed

Express Introduction

Express is a library for building web servers with Node. It gives short ways to answer visits to different addresses.

Load Express

This line loads the Express library.

const express = require('express');

Make an app

This line makes an app, the Express object that holds the server.

const app = express();

Example

const express = require('express');

const app = express();

console.log(typeof app);
console.log('Express app created');

Key points

  • A library is ready code that a program loads to do a job.
  • Express builds on the http module.
  • Express adds short ways to answer each address on its own.
  • Many Node servers are built with Express.
  • You load Express with require, like any other module.

In this example, the first line loads Express. The second line makes an app. The first print shows function, the kind of value an app is. The last line prints Express app created.

Note

Express is not built into Node, so install it first.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What is Express?