| <!doctype html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <style> |
| ul { |
| padding: 0; |
| margin: 0; |
| } |
| </style> |
| <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"> |
| <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="intro"> |
| <img id="logo" src="http://nodejs.org/images/logo.png" alt="node.js"> |
| |
| <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> |
| |
| <a href="#download" class="button" id="downloadbutton">Download</a> |
| <a href="api/" class="button" id="docsbutton">Docs</a> |
| <p class="version">__VERSION__</p> |
| </div> |
| <div id="quotes" class="clearfix"> |
| <h2>Node.js in the Industry</h2> |
| <ul> |
| <li class="microsoft"><img src="http://nodejs.org/images/microsoft-logo.png"> |
| <p>Node gives Azure users the first end-to-end JavaScript |
| experience for the development of a whole new class of real-time |
| applications. |
| <br> |
| <a href="http://blogs.msdn.com/b/interoperability/">Claudio Caldato</a> |
| <br> |
| <span>Principal Program Manager, Interoperability Strategy</span></p></li> |
| |
| <li class="ebay"><img src="http://nodejs.org/images/ebay-logo.png"> |
| <p>Node’s evented I/O model freed us from worrying about locking |
| and concurrency issues that are common with multithreaded async |
| I/O. |
| <br> |
| <a href="http://www.ebaytechblog.com/2011/11/30/announcing-ql-io/">Subbu Allamarju</a> |
| <br> |
| <span>Principal Member, Technical Staff</span></p></li> |
| |
| <li class="linkedin"><img src="http://nodejs.org/images/linkedin-logo.png"> |
| <p>On the server side, our entire mobile software stack is |
| completely built in Node. One reason was scale. The second is |
| Node showed us huge performance gains. |
| <br> |
| <a href="http://venturebeat.com/2011/08/16/linkedin-node/">Kiran Prasad</a> |
| <br> |
| <span>Director of Engineering, Mobile</span></p></li> |
| |
| <li class="yahoo"><img src="http://nodejs.org/images/yahoo-logo.png"> |
| <p>Node.js is the execution core of Manhattan. Allowing |
| developers to build one code base using one language – that is |
| the nirvana for developers. |
| <br> |
| <a href="http://developer.yahoo.com/blogs/ydn/posts/2011/11/yahoo-announces-cocktails-%E2%80%93-shaken-not-stirred/">Renaud Waldura</a> |
| <br> |
| <span>Sr. Product Manger, Cocktail</span></p></li> |
| </ul> |
| </div> |
| |
| <div id="download"> |
| <a href="#" id="download-close">X</a> |
| <img id="download-logo" src="http://nodejs.org/images/download-logo.png" alt="node.js"> |
| <ul id="installers" class="clearfix"> |
| <li><a href="http://nodejs.org/dist/__VERSION__/node-__VERSION__.msi">Windows Installer</a><br>node-__VERSION__.msi</li> |
| <li><a href="http://nodejs.org/dist/__VERSION__/node-__VERSION__.pkg">Macintosh Installer</a><br>node-__VERSION__.pkg</li> |
| <li id="source"><a href="http://nodejs.org/dist/__VERSION__/node-__VERSION__.tar.gz">Source Code</a><br>node-__VERSION__.tar.gz</li> |
| </ul> |
| <ul id="documentation"> |
| <li><a href="https://raw.github.com/joyent/node/__VERSION__/ChangeLog">Change Log</a></li> |
| <li><a href="http://nodejs.org/docs/__VERSION__/api/">Documentation</a></li> |
| <li><a href="http://nodejs.org/dist/__VERSION__">Other release files</a></li> |
| <li><a href="https://raw.github.com/joyent/node/__VERSION__/LICENSE">License</a></li> |
| <li><a href="https://github.com/joyent/node">Git Repository</a></li> |
| <li><a href="https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager">Installing |
| with a Package Manager</a> |
| </ul> |
| </div> |
| |
| <script>;(function() { |
| // attach as soon as the required elements are in the DOM. |
| // don't need to wait for entire document to be ready, since we're |
| // not adding any *new* nodes to the <body>, so there's no threat |
| // of 'Invalid operation' errors in old MSIE 6. |
| document.getElementById('downloadbutton').onclick = function(e) { |
| e = e || window.event; |
| e.stopPropagation && e.stopPropagation(); |
| e.cancelBubble = true; |
| // need to give the hash a tick to update |
| setTimeout(downloadDialogUpdate, 0); |
| }; |
| |
| document.getElementById('download-close').onclick = |
| document.documentElement.onclick = function(e) { |
| e = e || window.event; |
| if (location.hash === '#download') location.hash = ''; |
| downloadDialogUpdate(); |
| }; |
| |
| document.getElementById('download').onclick = function(e) { |
| e = e || window.event; |
| e.stopPropagation && e.stopPropagation(); |
| e.cancelBubble = true; |
| }; |
| |
| // I keep expecting <Esc> to close the dialog... |
| document.documentElement.onkeydown = function(e) { |
| e = e || window.event; |
| var k = e.which || e.keyCode || e.keyIdentifier; |
| if (typeof k === 'string') k = k.charCodeAt(0); |
| if (k === 27) document.documentElement.onclick(e); |
| }; |
| |
| // hacky workaround for old ie browsers that don't support :target css. |
| function downloadDialogUpdate () { |
| var div = document.getElementById('download'); |
| if (!div) return; |
| var expect = location.hash === '#download' ? 'block' : 'none'; |
| var actual = div.currentStyle ? div.currentStyle.display |
| : window.getComputedStyle |
| ? document.defaultView.getComputedStyle(div, null).getPropertyValue('display') |
| : null; |
| |
| // it looks like a string, but it might not actually be a string. |
| // explicitly cast for MSIE 6 and 7. |
| actual = '' + actual; |
| expect = '' + expect; |
| if (actual !== expect) { |
| div.style.display = expect; |
| } |
| } |
| downloadDialogUpdate(); |
| })();</script> |
| |
| <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:</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> |
| |
| <!-- <p>Ready to dig in? <a href="">Download the latest version</a> of node.js or learn how other organizations are <a href="">using the technology</a>.</p> --> |
| </div> |
| <div id="column2"> |
| <h2>Featured</h2> |
| <a href="http://www.youtube.com/watch?v=jo_B4LTHi3I"><img src="http://nodejs.org/images/ryan-speaker.jpg"></a> |
| A guided introduction to Node |
| |
| <h2>Explore Node.js</h2> |
| <ul id="explore"> |
| <li><a href="about/" class="explore">About</a><br><span>Technical overview</span></li> |
| <li><a href="http://search.npmjs.org/" class="explore">npm Registry</a><br><span>Modules, resources and more</span></li> |
| <li><a href="http://nodejs.org/api/" class="explore">Documentation</a><br><span>API Specifications</span></li> |
| <li><a href="http://blog.nodejs.org" class="explore">Node.js Blog</a><br><span>Insight, perspective and events</span></li> |
| <li><a href="community/" class="explore">Community</a><br><span>Mailing lists, blogs, and more</span></li> |
| <li><a href="logos/" class="explore">Logos</a><br><span>Logo and desktop background</span></li> |
| <li><a href="http://jobs.nodejs.org/" class="explore">Jobs</a><br><ol class="jobs"><!-- JOBS --><!-- JOBS --></ol></li> |
| </ul> |
| </div> |
| </div> |
| |
| <div id="footer"> |
| <ul class="clearfix"> |
| <li><a href="/">Node.js</a></li> |
| <li><a href="/#download">Download</a></li> |
| <li><a href="/about/">About</a></li> |
| <li><a href="http://search.npmjs.org/">npm Registry</a></li> |
| <li><a href="http://nodejs.org/api/">Docs</a></li> |
| <li><a href="http://blog.nodejs.org">Blog</a></li> |
| <li><a href="/community/">Community</a></li> |
| <li><a href="/logos/">Logos</a></li> |
| <li><a href="http://jobs.nodejs.org/">Jobs</a></li> |
| <!-- <li><a hrfe="http://twitter.com/nodejs" class="twitter">@nodejs</a></li> --> |
| </ul> |
| |
| <p>Copyright <a href="http://joyent.com">Joyent, Inc</a>, Node.js is a <a href="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <a href="https://raw.github.com/joyent/node/__VERSION__/LICENSE">license</a>.</p> |
| </div> |
| |
| |
| <script src="sh_main.js"></script> |
| <script src="sh_javascript.min.js"></script> |
| <script>highlight(undefined, undefined, 'pre');</script> |
| |
| <script> |
| var gaJsHost = (("https:" == document.location.protocol) ? |
| "https://ssl." : "http://www."); |
| document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); |
| </script> |
| <script> |
| try { |
| var pageTracker = _gat._getTracker("UA-10874194-2"); |
| pageTracker._trackPageview(); |
| } catch(err) {} |
| </script> |
| </body> |
| </html> |