Browse Source

XHTML compliant HTML and a few spelling fixes

v0.7.4-release
Urban Hafner 16 years ago
parent
commit
565becb8ad
  1. 1076
      website/api.html
  2. 306
      website/index.html

1076
website/api.html

File diff suppressed because it is too large

306
website/index.html

@ -1,18 +1,21 @@
<html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<style> <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
ul { ul {
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
</style> </style>
<script type="text/javascript" src="sh_main.js"></script> <script type="text/javascript" src="sh_main.js"></script>
<script type="text/javascript" src="sh_javascript.min.js"></script> <script type="text/javascript" src="sh_javascript.min.js"></script>
<link type="text/css" rel="stylesheet" href="style.css"> <link type="text/css" rel="stylesheet" href="style.css" />
<link type="text/css" rel="stylesheet" href="sh_vim-dark.css"> <link type="text/css" rel="stylesheet" href="sh_vim-dark.css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>node.js</title> <title>node.js</title>
<body onload="sh_highlightDocument();"> </head>
<div id="toc"> <body onload="sh_highlightDocument();">
<div id="toc">
<ol> <ol>
<li><a href="#audience">Audience</a></li> <li><a href="#audience">Audience</a></li>
<li><a href="#about">About</a></li> <li><a href="#about">About</a></li>
@ -21,18 +24,22 @@
<li><a href="#community">Community</a></li> <li><a href="#community">Community</a></li>
<li><a href="api.html">Documentation</a></li> <li><a href="api.html">Documentation</a></li>
</ol> </ol>
</div> </div>
<div id="content"> <div id="content">
<h1><a href="http://tinyclouds.org/node">Node</a></h1> <h1><a href="http://tinyclouds.org/node">Node</a></h1>
<p id="introduction">Purely event-based I/O for <a <p id="introduction">
href="http://code.google.com/p/v8/">V8 javascript</a>. Purely event-based I/O for
<a href="http://code.google.com/p/v8/">V8 javascript</a>.
</p>
<p>An example of a web server written with Node which responds with <p>
"Hello World" after waiting two seconds: An example of a web server written with Node which responds with
"Hello World" after waiting two seconds:
</p>
<pre> <pre>
new node.http.Server(function (req, res) { new node.http.Server(function (req, res) {
setTimeout(function () { setTimeout(function () {
res.sendHeader(200, [["Content-Type", "text/plain"]]); res.sendHeader(200, [["Content-Type", "text/plain"]]);
@ -40,135 +47,156 @@ new node.http.Server(function (req, res) {
res.finish(); res.finish();
}, 2000); }, 2000);
}).listen(8000); }).listen(8000);
puts("Server running at http://127.0.0.1:8000/"); puts("Server running at http://127.0.0.1:8000/");</pre>
</pre>
<p>
<p> To run the server, put the code into a file <code>example.js</code> To run the server, put the code into a file
and execute it with the <code>node</code> program <code>example.js</code> and execute it with the <code>node</code>
<pre class="sh_none">% /usr/local/bin/node example.js program
Server running at http://127.0.0.1:8000/ </p>
</pre> <pre class="sh_none">
% /usr/local/bin/node example.js
<p> See the <a href="api.html">API documentation</a> for more examples. Server running at http://127.0.0.1:8000/</pre>
<h2 id="audience">Audience</h2> <p>
See the <a href="api.html">API documentation</a> for more
<p>This project is for those interested in examples.
<ul> </p>
<li>server-side javascript
<li>developing evented servers <h2 id="audience">Audience</h2>
<li>developing new web frameworks
</ul> <p>This project is for those interested in</p>
<ul>
<h2 id="about">About</h2> <li>server-side javascript</li>
<li>developing evented servers</li>
<p> Node's goal is to provide an easy way to build scalable network <li>developing new web frameworks</li>
programs. </ul>
In the above example, the 2 second delay does not prevent the server from
handling new requests. <h2 id="about">About</h2>
Node tells the operating system (through
<code>epoll</code>, <p>
<code>kqueue</code>, Node's goal is to provide an easy way to build scalable network
<code class="sh_none">/dev/poll</code>, programs. In the above example, the 2 second delay does not
or <code>select</code>) prevent the server from handling new requests. Node tells the
that it should be notified when the 2 seconds are up or if a new connection operating system (through <code>epoll</code>, <code>kqueue</code>,
is made&mdash;then it goes to sleep. If someone new connects, then it <code class="sh_none">/dev/poll</code>, or <code>select</code>)
executes the callback, if the timeout expires, it executes the inner that it should be notified when the 2 seconds are up or if a new
callback. Each connection is only a small heap allocation. connection is made&mdash;then it goes to sleep. If someone new
connects, then it executes the callback, if the timeout expires,
<p>This is in contrast to today's more common model it executes the inner callback. Each connection is only a small
where OS threads are employed for concurrency. Thread-based networking heap allocation.
<a href="http://www.sics.se/~joe/apachevsyaws.html">is</a> </p>
<a href="http://www.kegel.com/c10k.html">relatively</a>
<a href="http://bulk.fefe.de/scalable-networking.pdf">inefficient</a> <p>
<!-- TODO needs links --> This is in contrast to today's more common model where OS threads
and are employed for concurrency. Thread-based networking
very <a href="http://www.sics.se/~joe/apachevsyaws.html">is</a>
difficult <a href="http://www.kegel.com/c10k.html">relatively</a>
to <a href="http://bulk.fefe.de/scalable-networking.pdf">inefficient</a>
use. <!-- TODO needs links -->
and very difficult to use.
Node will show much better memory efficiency under high-loads
<!-- TODO benchmark --> Node will show much better memory efficiency under high-loads
than systems which allocate 2mb thread stacks for each connection. <!-- TODO benchmark -->
than systems which allocate 2mb thread stacks for each connection.
Furthermore, users of Node are free from worries of dead-locking the
process&mdash;there are no locks. No function in Node directly performs Furthermore, users of Node are free from worries of dead-locking
I/O, so the process never blocks. Because nothing blocks, less-than-expert the process&mdash;there are no locks. No function in Node
programmers are able to develop fast systems. directly performs I/O, so the process never blocks. Because
nothing blocks, less-than-expert programmers are able to develop
<p>Node is similar in design to systems like fast systems.
Ruby's <a href="http://rubyeventmachine.com/">Event Machine</a> </p>
or
Python's <a href="http://twistedmatrix.com/">Twisted</a>. <p>
Node takes the event model a bit further. For example, in other systems Node is similar in design to systems like Ruby's
there is always a blocking call to start the event-loop. Typically one <a href="http://rubyeventmachine.com/">Event Machine</a>
defines behavior through callbacks at the beginning of a script and at the or Python's <a href="http://twistedmatrix.com/">Twisted</a>.
end starts a server through a call like <code>EventMachine::run()</code>. Node takes the event model a bit further. For example, in other
In Node it works differently. By default Node enters the event loop after systems there is always a blocking call to start the event-loop.
executing the input script. Node exits the event loop when there are no more Typically one defines behavior through callbacks at the beginning
callbacks to perform. Like in traditional browser javascript, the event loop of a script and at the end starts a server through a call like
is hidden from the user. <code>EventMachine::run()</code>. In Node it works differently.
By default Node enters the event loop after executing the input
<p>Node's HTTP API has grown out of my difficulties developing and working script. Node exits the event loop when there are no more callbacks
with web servers. For example, streaming data through most web frameworks is to perform. Like in traditional browser javascript, the event loop
impossible. Or the oft-made false assumption that all message headers have is hidden from the user.
unique fields. Node attempts to correct these and other problems in its </p>
API. Coupled with Node's purely evented infrastructure, it will make a
more comprehensive foundation for future web libraries/frameworks. <p>
Node's HTTP API has grown out of my difficulties developing and
<p> <i>But what about multiple-processor concurrency? Threads are necessary working with web servers. For example, streaming data through
to scale programs to multi-core computers.</i> The name <i>Node</i> should most web frameworks is impossible. Or the oft-made false
give some hint at how it is envisioned being used. Processes are necessary assumption that all message headers have unique fields. Node
to scale to multi-core computers, not memory-sharing threads. The attempts to correct these and other problems in its API. Coupled
fundamentals of scalable systems are fast networking and non-blocking with Node's purely evented infrastructure, it will make a more
design&mdash;the rest is message passing. In the future, I'd like Node to comprehensive foundation for future web libraries/frameworks.
to be able to spawn new processes (probably using the <a </p>
href="http://www.whatwg.org/specs/web-workers/current-work/">Web Workers
API</a>), but this is something that fits well into the current design. <p>
<i>
<h2 id="download">Download</h2> But what about multiple-processor concurrency? Threads are
necessary to scale programs to multi-core computers.
<p><a href="http://github.com/ry/node/tree/master">The git repo</a> </i>
The name <i>Node</i> should give some hint at how it is envisioned
<ul> being used. Processes are necessary to scale to multi-core
<li> 2009.05.31 <a href="http://s3.amazonaws.com/four.livejournal/20090531/node-0.0.2.tar.gz">node-0.0.2.tar.gz</a> computers, not memory-sharing threads. The fundamentals of scalable
<li> 2009.05.27 <a href="http://s3.amazonaws.com/four.livejournal/20090527/node-0.0.1.tar.gz">node-0.0.1.tar.gz</a> systems are fast networking and non-blocking design&mdash;the rest
</ul> is message passing. In the future, I'd like Node to to be able to
spawn new processes (probably using the
<a href="http://www.whatwg.org/specs/web-workers/current-work/">
<h2 id="build">Build</h2> Web Workers API
</a>), but this is something that fits well into the current design.
<p>Node eventually wants to support all POSIX operating systems (including </p>
Windows with MinGW) but at the moment it is only being tested on
<b>Linux</b>, <h2 id="download">Download</h2>
<b>Macintosh</b>, and
<b>FreeBSD</b>. The build system requires Python. V8, on which <p>
Node is built, supports only IA-32 and ARM processors. V8 is included in the <a href="http://github.com/ry/node/tree/master">The git repo</a>
Node distribution. There are no dependencies. </p>
<ul>
<pre class="sh_none"> <li>
2009.05.31
<a href="http://s3.amazonaws.com/four.livejournal/20090531/node-0.0.2.tar.gz">node-0.0.2.tar.gz</a>
</li>
<li>
2009.05.27
<a href="http://s3.amazonaws.com/four.livejournal/20090527/node-0.0.1.tar.gz">node-0.0.1.tar.gz</a>
</li>
</ul>
<h2 id="build">Build</h2>
<p>
Node eventually wants to support all POSIX operating systems
(including Windows with MinGW) but at the moment it is only being
tested on <b>Linux</b>, <b>Macintosh</b>, and <b>FreeBSD</b>. The
build system requires Python. V8, on which Node is built,
supports only IA-32 and ARM processors. V8 is included in the Node
distribution. There are no dependencies.
</p>
<pre class="sh_none">
./configure ./configure
make make
make install make install</pre>
</pre>
<p> Then have a look at the <a href="api.html">API documentation</a>. <p>
Then have a look at the <a href="api.html">API documentation</a>.
</p>
<p>To run the tests <p>To run the tests</p>
<pre class="sh_none"> <pre class="sh_none">
./configure --debug ./configure --debug
make test make test</pre>
</pre>
<h2 id="community">Community</h2> <h2 id="community">Community</h2>
<p> <p>
For help and discussion subscribe to the mailing list at For help and discussion subscribe to the mailing list at
<a href="http://groups.google.com/group/nodejs">http://groups.google.com/group/nodejs</a> <a href="http://groups.google.com/group/nodejs">http://groups.google.com/group/nodejs</a>
or send an email to <a href="mailto:nodejs+subscribe@googlegroups.com">nodejs+subscribe@googlegroups.com</a>. or send an email to <a href="mailto:nodejs+subscribe@googlegroups.com">nodejs+subscribe@googlegroups.com</a>.
</p> </p>
</div>
</body> </body>
</html> </html>

Loading…
Cancel
Save