Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Node.js Router Should I Use? [closed]

Tags:

I want to develop a CMS and I need a good routing system for Node.js.

I don't have any predecisions and I'm open any advice.

like image 984
Lupus Avatar asked Feb 08 '12 21:02

Lupus


People also ask

Where Nodejs should not be used?

Node. js will never be “the best choice” for event loop-blocking use cases (take asynchronous parsing XML, for instance) … nor for powering apps relying on intense computation.

Which node JS should I use?

The Node JS website states that “Production applications should only use Active LTS or Maintenance LTS releases” (Node JS org, 2020). This all means that if today you start learning with Node JS 16, you are good to deploy a production app with this version till March 2024.

How do I close a node JS connection?

end() before the callback is triggered, because Closing the connection is done using end() which makes sure all remaining queries are executed before sending a quit packet to the mysql server.

CAN node js handle high traffic?

In this article, we will consider some practices that you should adopt to scale your Node. js servers. Your servers will then be able to handle high traffic workloads without a degraded user experience.


2 Answers

Express

express has a rock solid router build into it. It's got a lovely DSL syntax

router.get("/foo/:id/:item", function (req, res) {     console.log(req.params.id); }); 

Director

Director is an awesome standalone router that is part of Flatiron

router.get(/hola/, helloWorld) 

Your own

For a lightweight codebase spinning up your own router using regular expressions is really easy

like image 169
Raynos Avatar answered Oct 04 '22 02:10

Raynos


You may want to look at the module wiki to see a list of routers:

https://github.com/joyent/node/wiki/modules#wiki-web-frameworks-routers

I agree with the other answer on express.

like image 36
sirhc Avatar answered Oct 04 '22 04:10

sirhc