ExpressJs

express

Introduction

Express is a minimal yet flexible and powerful web development framework for the Node.js (Node) platform.
Express is minimal :- Express is minimal because it does not come loaded with all sorts of functionality, which makes it a bloat-free framework. Out of the box, it supports only the very basic features of a web framework. Even the supported features are not all enabled by default, you have the option to pick and use, according to your needs.
Express is flexible :- The flexibility in Express comes from the use of middlewares and Node modules. Express middlewares and Node modules are pluggable JavaScript components, which make Express apps very modular, flexible, and extensible.
Express is powerful :- Express is a powerful framework because it gives you complete access to the core Node APIs. Anything you can do with Node, you can do it with Express too.Express can be used to create very simple to very complex web apps. It provides you all the tools required to create the most complex of apps, but does not force you to use them when you don’t need them.

Some other web frameworks that you may be familiar with are :-

  • Ruby on Rails (Ruby)
  • Sinatra (Ruby)
  • Django (Python)
  • Zend (PHP)

Why use Express?

Express is a lightweight framework, meaning it does not make too many assumptions but gives you enough to avoid re-inventing the wheel.

Some of the things you can do with Express include

  • Simple brochure websites
  • JSON based APIs
  • Realtime web applications

Some reasons for using a framework like Express include

  • It takes less time to create applications using a framework.
  • Common patterns like routing and view layers are accounted for in a framework like Express, meaning you do not have to write code for this.
  • A framework like Express is actively used, maintained and tested. The stability of the code can be assumed.

Frameworks like Express are not appropriate for everything though. If you are creating a command line script you would certainly not want to use something like Express.

Installing Express

Express is meant to be installed as a global module, so that we can use its express command-line tool to generate Express app skeletons quickly.

Command to Install Express Globally :-

Here is an example of installing an older version of Express:-

Check the version of Express