Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Express 3/4 and Express Framework?

Going through the socket.io documentation I discovered that there is express v.3/4 and express framework. What is the difference?

like image 421
N Klosterman Avatar asked Jun 24 '14 02:06

N Klosterman


People also ask

What does express framework do?

Express is a node js web application framework that provides broad features for building web and mobile applications. It is used to build a single page, multipage, and hybrid web application. It's a layer built on the top of the Node js that helps manage servers and routes.

Is Express JS library or framework?

Introducing Express Express is the most popular Node web framework, and is the underlying library for a number of other popular Node web frameworks. It provides mechanisms to: Write handlers for requests with different HTTP verbs at different URL paths (routes).

Is Express a framework or middleware?

Express is a routing and middleware web framework that has minimal functionality of its own: An Express application is essentially a series of middleware function calls.


1 Answers

In the context of the socket.io docs, "Express Framework" means Express 2.x.

There were a number of breaking API changes between Express 2 and Express 3. The code to use socket.io with these versions is different, which is why they are listed separately.

(This is so labeled because Express 2 was the only version in wide use when socket.io first came out. When v3 came out, a section was added noting the difference in API, but the original section wasn't renamed. Now, the terminology is just confusing. Issue filed.)


The following is what I posted originally, when I thought the question was asking about the difference between Express 3 and 4. Since this question is a top Google result for "difference between express 3 and 4", I'm going to leave it here.

The difference between Express 3 and 4 is fully documented in the Express Wiki.

  • Migrating from 3.x to 4.x
  • New features in 4.x

The biggest change is that connect is no longer a dependency, and therefore many previously included middleware functions are no longer in the box. This means things like bodyParser are now obtained separately.

Additionally, app.router no longer exists, which means app.get etc and app.use are now processed in the exact order you add them.

like image 197
josh3736 Avatar answered Sep 23 '22 23:09

josh3736