Skip to content Skip to sidebar Skip to footer

Which Node.js Router Should I Use?

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.

Solution 1:

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

Solution 2:

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.

Solution 3:

The canonical web framework for NodeJS, express, contains a very good, very flexible router. If you don't know anything else about your routing needs, you should start there, as it is well supported and there is a great community to help.

Post a Comment for "Which Node.js Router Should I Use?"