I'm feeling a bit confused, there are so many frameworks out there for Node.js related 'stuff'. Would someone be able to give me an overview of - how the following libraries/frameworks/whatever relate/interact with each other - what's included or what the main purpose is for each of them? - differences between them
Also, if there are any others I've left off my list, feel free to add them and a description of what they are and how they fit in too.
js is actually not a framework or a library, but a runtime environment, based on Chrome's V8 JavaScript engine.
Node. js frameworks are mainly of three types — MVC, Full-Stack MVC, and REST API frameworks.
There are three kinds of Node JS frameworks – MVC, Full-Stack MVC, and REST API.
AngularJS, PHP, Python, JavaScript, and React are the most popular alternatives and competitors to Node. js.
Most of the things you listed are related only because they are written in or otherwise use JavaScript. Comparing them is much like comparing apples to oranges. It's like asking what the difference is between a Toyota Camry and a V6 engine. They are related, but do different things.
Node
Also known as Node.js, Node is the JavaScript environment on which we run our server-side JavaScript code. It is based on the V8 JavaScript engine. All of the JavaScript code you write, or install and run from packages from NPM, GitHub, etc. is executed by the Node runtime environment.
CoffeeScript
CoffeeScript is, plain and simple, a programming language that compiles down to JavaScript. Its purpose is to expose all the power of JavaScript in a simpler way. It's important to keep in mind that all CoffeeScript code just gets compiled to JavaScript when you run it; the differences are purely syntactical. Its website has much more information.
Backbone
Backbone can be likened to as a Model-View-Controller framework for JavaScript. I believe it was originally written for the browser; it helps keep your client-side JavaScript clean by implementing most common MVC patterns (as well as a couple other things), allowing you to more easily connect your client-side JavaScript to your server-side code.
Express
Express is a web framework for Node.js built on Connect. It is similar in many aspects to Sinatra for Ruby. It allows you to easily create web sites with routing, layouts/partials/views, sessions, and more. There are a lot of third-party modules for Express, making it pretty easy to get exactly the kind of stack you need.
There are a ton of modules out there for Node; as of this writing, NPM has over 3,000 published packages, and covering even the most popular ones would take some amount of time! Be sure to give NPM or the module list page a look any time you need to solve a new problem to avoid inventing the wheel (unless you want to learn a lot about wheels. :)
With node.js you only need to choose one framework. For frameworks some popular ones are
I've only used express
and I can vouch it is fantastic. It has a great community and fantastic support. It's also the only library I know that just works and that says a lot.
Apart from that the node community uses optimized modules that solve one problem, when they need that problem solved. Frameworks should handle the minimal problems of handling HTTP request and express
solves that.
Below is an except from package.json file.
"dependencies": {
// my framework, used to handle HTTP
"express": "2.4.4",
// a very specific validation module used for input validation
"validator": "0.2.7",
// dust a templating engine
"dust": "0.3.0",
// a uuid factory
"node-uuid": "1.2.0",
// a markdown parser
"marked": "0.0.4",
// a HTTP request library
"request": "2.0.3",
// a traits (OOP) library
"traits": "0.4.0",
// a file tree watcher
"watch": "0.3.2",
// a CSS abstraction
"less": "1.1.4",
// a flow control library
"after": "0.1.0",
// a utility to extend Buffer
"buffertools": "1.0.3"
},
"devDependencies": {
// a unit testing library
"vows-fluent": "0.1.0",
// a unit testing utility
"should": "0.2.1",
// hot code reloading
"nodemon": "0.5.3",
// debugger
"node-inspector": "0.1.9"
}
As you can see, I use one framework and a whole range of hand chosen utility libraries that solve one task. For the other tasks I roll out my own (a few of the libraries listed above are my own).
For example I used to recommend backbone
as a solid MVC library but it just doesn't work with node. So I rolled out my own MVC abstraction. I also used to recommend cradle
as a solid CouchDB abstraction but it leaked, so I stepped down and wrote my own database access code using request
to talk to CouchDB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With