Difference between Express and Connect npm packages
Asked Answered
E

2

23

I have been using express webservers since I started working on Node.js and a few days ago I came across this new (to me) web server, called connect.

Can anyone point out, what are the differences between the express and connect? When should we use connect and when to go for express?

As far as I know, both are web-servers based on HTTP module of Node.js.

Which one should go for?

Please be more descriptive and post some useful links to start with.

Exarch answered 24/5, 2018 at 8:20 Comment(1)
Does this answer your question? What is Node.js' Connect, Express and "middleware"?Disjunct
S
23

In a nutshell, connect provides the use of middlewares in your application, everything connect can do, express can do it also, but express adds other useful things such as a view engine... see here and here to help you decide.

Sinistrocular answered 24/5, 2018 at 9:44 Comment(2)
Before 4.x express was built on top of connect.Acicula
@LeonidBeschastny And afterwards?Arching
B
-2

1.Node.js Node.js has a simple http/https based create server method with a callback (arguments - req/res).

var server = http.createServer(function (req, res) {
    res.write('server up');
}

2.Connect.js Connect is basically middleware framework similar to Express. Connect extends the built-in http server functionality using which you can handle req and res objects, and it also helps you use "plugins" using the .use method.

Brotherly answered 24/5, 2018 at 10:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.