Greenspun's Tenth Rule:
Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.
aka JavaScript

"A web app is a website that doesn't work when Javascript is disabled." - Jeremy Keith @adactio
It's already everywhere.
A few silly examples:
Less silly examples:
Or at least doesn't make a model.
Run "node", it gives you a prompt, type "console.", hit tab, boom, list of methods to the console object.
node helloworld.js
(function(exports) {
// Define all your functions on the
// exports object
exports.doubleIt = function(it) {
it = Number(it);
return it + it;
};
})((typeof process === 'undefined'
|| !process.versions) ?
window.common = window.common || {}
: exports);
HTML:
<html><head>
<script src="commonfunc.js"></script>
</head><body>
<script>
var it = 2;
alert("Doubling "+it+" yields "
+ window.common.doubleIt(2));
</script>
</body></html>var common = require('./commonfunc.js');
console.log("Doubling 2 to get "
+ common.doubleIt(2));
test/test.js
deploy: ...
jshint *.js
mocha tests
rsync ... remote@server:/path/to/project
...
var assert = require("assert");
var common = require('../commonfunc.js');
describe('common', function(){
describe('#doubleIt()', function() {
it('should return 4 when called with 2',
function()
{
assert.equal(4, common.doubleIt(2))
} );
// and so forth ...
})
});
A computer is a state machine. Threads are for people who can't program state machines. Alan Cox
// Load the TCP Library
net = require('net');
var common = require('./commonfunc.js');
// Start a TCP Server
net.createServer(
function (socket)
{
socket.on('data',
function(data)
{ var s = "" + data;
socket.write(
common.doubleIt(s.replace("\n",""))
+ "\n"); });
}).listen(5000)var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200,
{'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
var http = require('http');
var server = http.createServer(
function (request, response) {
response.writeHead(200,
{"Content-Type": "text/plain"});
response.end("Hello World\n");
});
server.listen(8000);
var server =
require('node-router').getServer();
server.get("/",
function (request, response) {
response.simpleText(200, "Hello World!");
});
server.listen(8000, "localhost");
Hybrid solutions render HTML, send that HTML across along with enough JavaScript to use that HTML as a template. This gives super fast initial page rendering, and then allows JSON thereafter.
Other languages have fully-formed frameworks and content management systems, Node has some components upon which you can hang an app, frameworks are still coming together.
danlyke@flutterby.com http://www.flutterby.net/User:DanLyke
| Table of Contents | t |
|---|---|
| Exposé | ESC |
| Full screen slides | e |
| Presenter View | p |
| Source Files | s |
| Slide Numbers | n |
| Toggle screen blanking | b |
| Show/hide slide context | c |
| Notes | 2 |
| Help | h |