Can node.js be used as a general framework for running server-side Javascript specifically for web applications, totally unrelated to it's non-blocking and asynchrouns I/O functionality? Specifically I want to know if I can run arbitrary Javascript on the (web) server without using the other node.js functionality.
Can node.js be used as a framework for running arbitrary server-side Javascript in web applications?
4 Answers
Yes, it's possible to use node.js for command-line applications, for example:
$ cat hello.js
console.log('Hello world!');
$ node hello.js
Hello world!
It's essentially just like any scripting language in this regard.
1 Comment
Yes. There are many web frameworks built on node. The most known is Express based on Connect.
Connect takes the familiar concepts of Ruby's Rack and applies it to the asynchronous world of node
Express:
High performance, high class web development for Node.js
But I/O - web request for example - depends on node's asynchronous and non-blocking functionality.
Comments
Yes. What is important to understand is that Node is a set of I/O bindings (file, TCP, etc) that layers on top of Chrome's V8 JavaScript interpreter.
You can use Node in two modes:
Execute a known JavaScript file
$ node some_script.js
Execute in REPL (interactive mode)
$ node
var i = 1;
console.log(i);
1