blob: 268301ed6a285932f1d909054984aa6aa71d8b84 [file] [log] [blame]
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link type="image/x-icon" rel="icon" href="favicon.ico">
<link type="image/x-icon" rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="/pipe.css">
<link rel="stylesheet" href="/sh_vim-dark.css">
<script type="text/javascript" src="//use.typekit.net/mse5tqx.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<link rel="alternate"
type="application/rss+xml"
title="node blog"
href="http://feeds.feedburner.com/nodejs/123123123">
<title>node.js</title>
</head>
<body id="front">
<div id="nav">
<img id="logo" src="/images/logo.svg" alt="node.js">
<ul>
<li class="active"><a href="/">Home</a></li>
<li><a href="/download"/>Downloads</a></li>
<li><a href="/documentation/">Docs</a></li>
<li><a href="/community/">Community</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://jobs.nodejs.org">Jobs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
</ul>
</div>
<div id="intro">
<p>Node.js is a platform built on <a
href="http://code.google.com/p/v8/">Chrome's JavaScript runtime</a>
for easily building fast, scalable network applications. Node.js
uses an event-driven, non-blocking I/O model that makes it
lightweight and efficient, perfect for data-intensive real-time
applications that run across distributed devices.</p>
<p class="version">Current Version: v0.10.30</p>
<div class=buttons>
<a href="http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz" class="button downloadbutton" id="downloadbutton">INSTALL</a>
<a href="download/" class=button id="all-dl-options">Downloads</a
><a href="api/" class="button" id="docsbutton">API Docs</a>
</div>
</div>
<div id="promo">
<a href="http://www.joyent.com/noderoad"><img src="images/roadshow-promo.png"></a>
</div>
<div id="content-wrap">
<div id="content" class="clearfix">
<div id="column1">
<h2>An example: Webserver</h2>
<p>This simple web server written in Node responds with "Hello World" for every request.</p>
<pre>
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');
console.log('Server running at http://127.0.0.1:1337/');</pre>
<p>To run the server, put the code into a file
<code>example.js</code> and execute it with the
<code>node</code> program from the command line:</p>
<pre class="sh_none">
% node example.js
Server running at http://127.0.0.1:1337/</pre>
<p>Here is an example of a simple TCP server which listens on port 1337 and echoes whatever you send it:</p>
<pre>
var net = require('net');
var server = net.createServer(function (socket) {
socket.write('Echo server\r\n');
socket.pipe(socket);
});
server.listen(1337, '127.0.0.1');</pre>
</div>
<div id="column2" class="featured">
<h2>Featured</h2>
<a href="/video/"><img src="/images/walmart-thumb.jpg" width="263"></a>
<h3>Node.js at Walmart</h3>
<p><a href="http://twitter.com/eranhammer">Eran Hammer</a>, Principal Architect at Walmart, talks about how they use Node.js as a way to reinvent legacy APIs to create modern front end experiences.</p>
</div>
</div>
</div>
<div id="footer">
<div class="foot-1">
<a href="http://www.joyent.com"><h5>The Node.js Project is Sponsored by</h5>
<img src="/images/joyent-footer.svg" width="200">
<p class="tag">Production Node +<br>High Performance Infrastructure</p></a>
<a href="https://my.joyent.com/landing/signup/701800000015696" class="button getstarted">Get Started</a>
</div>
<div class="foot-2">
<div class="foot-nav">
<ul>
<li><a href="http://nodejs.org/download/">Downloads</a></li>
</ul>
<ul>
<li><a href="http://nodejs.org/documentation/">Documentation</a></li>
<li><a href="http://nodejs.org/documentation/api/">API Docs</a></li>
<li><a href="http://nodejs.org/documentation/tutorials/">Tutorials</a></li>
<li><a href="http://nodejs.org/documentation/localization/">Localization</a></li>
</ul>
<ul>
<li><a href="http://nodejs.org/community/">Community</a></li>
<li><a href="https://github.com/joyent/node/issues">Github Issues</a></li>
<li><a href="http://groups.google.com/group/nodejs">Mailing List</a></li>
<li><a href="http://webchat.freenode.net/?channels=node.js">IRC</a></li>
<li><a href="https://twitter.com/nodejs">Twitter</a></li>
</ul>
<ul>
<li><a href="http://nodejs.org/about/">About</a></li>
<li><a href="http://nodejs.org/about/organization/">Organization</a></li>
<li><a href="http://nodejs.org/about/core-team/">Core Team</a></li>
<li><a href="http://nodejs.org/about/resources/">Resources</a></li>
</ul>
<ul>
<li><a href="http://blog.nodejs.org">Blog</a></li>
</ul>
</div>
<p class="copyright">Copyright 2014 <a href="http://joyent.com/">Joyent, Inc</a>, Node.js is a <a href="/images/trademark-policy.pdf">trademark</a> of Joyent, Inc. <a href="https://raw.github.com/joyent/node/v0.10.30/LICENSE">View license</a>.</p>
</div>
</div>
<script src="sh_main.js"></script>
<script src="sh_javascript.min.js"></script>
<script>highlight(undefined, undefined, 'pre');</script>
<script>
window._gaq = [['_setAccount', 'UA-10874194-2'], ['_trackPageview']];
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = '//www.google-analytics.com/ga.js';
s.parentNode.insertBefore(g, s);
}(document, 'script'));
;(function(d,n) {
var os = n.platform.match(/(Win|Mac|Linux)/);
var x = n.userAgent.match(/x86_64|Win64|WOW64/) ||
n.cpuClass === 'x64' ? 'x64' : 'x86';
var base = 'http://nodejs.org/dist/v0.10.30/';
var href = 'node-v0.10.30.tar.gz';
var db = d.getElementById('downloadbutton');
var d2;
switch (os && os[1]) {
case 'Mac':
href = 'node-v0.10.30.pkg';
break;
case 'Win':
href = 'node-v0.10.30-' + x + '.msi';
if (x === 'x64') href = 'x64/' + href;
break;
// TODO uncomment when we have these
// case 'Linux':
// // two buttons: .deb and .rpm
// href = 'node-v0.10.30-' + x + '.rpm';
// var d2 = document.createElement('a');
// d2.href = base + 'node-v0.10.30-' + x + '.deb';
// d2.className = 'button downloadbutton';
// d2.innerHTML = 'INSTALL .deb';
// db.innerHTML = 'INSTALL .rpm';
// db.parentNode.insertBefore(d2, db);
// break;
}
db.href = base + href;
// if there's one download option, then download it at #download
if (location.hash === '#download' && !d2)
location.replace(b.href);
})(document,navigator);
</script>
</body>
</html>