• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2<!doctype html>
3<html lang="en">
4  <head>
5  <meta charset="utf-8">
6    <link type="image/x-icon" rel="icon" href="favicon.ico">
7    <link type="image/x-icon" rel="shortcut icon" href="favicon.ico">
8    <link rel="stylesheet" href="/pipe.css">
9    <link rel="stylesheet" href="/sh_vim-dark.css">
10    <script type="text/javascript" src="//use.typekit.net/mse5tqx.js"></script>
11    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
12    <link rel="alternate"
13          type="application/rss+xml"
14          title="node blog"
15          href="http://feeds.feedburner.com/nodejs/123123123">
16    <title>node.js</title>
17  </head>
18  <body id="front">
19    <div id="nav">
20      <img id="logo" src="/images/logo.svg" alt="node.js">
21      <ul>
22        <li class="active"><a href="/">Home</a></li>
23        <li><a href="/download"/>Downloads</a></li>
24        <li><a href="/documentation/">Docs</a></li>
25        <li><a href="/community/">Community</a></li>
26        <li><a href="/about/">About</a></li>
27        <li><a href="http://jobs.nodejs.org">Jobs</a></li>
28        <li><a href="http://blog.nodejs.org">Blog</a></li>
29      </ul>
30    </div>
31    <div id="intro">
32
33        <p>Node.js is a platform built on <a
34        href="http://code.google.com/p/v8/">Chrome's JavaScript runtime</a>
35        for easily building fast, scalable network applications.  Node.js
36        uses an event-driven, non-blocking I/O model that makes it
37        lightweight and efficient, perfect for data-intensive real-time
38        applications that run across distributed devices.</p>
39
40        <p class="version">Current Version: v0.10.30</p>
41
42        <div class=buttons>
43        <a href="http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz" class="button downloadbutton" id="downloadbutton">INSTALL</a>
44
45        <a href="download/" class=button id="all-dl-options">Downloads</a
46        ><a href="api/" class="button" id="docsbutton">API Docs</a>
47        </div>
48    </div>
49
50    <div id="promo">
51      <a href="http://www.joyent.com/noderoad"><img src="images/roadshow-promo.png"></a>
52    </div>
53
54    <div id="content-wrap">
55    <div id="content" class="clearfix">
56            <div id="column1">
57                <h2>An example: Webserver</h2>
58                <p>This simple web server written in Node responds with "Hello World" for every request.</p>
59              <pre>
60var http = require('http');
61http.createServer(function (req, res) {
62  res.writeHead(200, {'Content-Type': 'text/plain'});
63  res.end('Hello World\n');
64}).listen(1337, '127.0.0.1');
65console.log('Server running at http://127.0.0.1:1337/');</pre>
66
67              <p>To run the server, put the code into a file
68              <code>example.js</code> and execute it with the
69              <code>node</code> program from the command line:</p>
70              <pre class="sh_none">
71% node example.js
72Server running at http://127.0.0.1:1337/</pre>
73
74                <p>Here is an example of a simple TCP server which listens on port 1337 and echoes whatever you send it:</p>
75
76                <pre>
77var net = require('net');
78
79var server = net.createServer(function (socket) {
80  socket.write('Echo server\r\n');
81  socket.pipe(socket);
82});
83
84server.listen(1337, '127.0.0.1');</pre>
85
86        </div>
87        <div id="column2" class="featured">
88            <h2>Featured</h2>
89            <a href="/video/"><img src="/images/walmart-thumb.jpg" width="263"></a>
90            <h3>Node.js at Walmart</h3>
91            <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>
92        </div>
93    </div>
94    </div>
95
96    <div id="footer">
97      <div class="foot-1">
98        <a href="http://www.joyent.com"><h5>The Node.js Project is Sponsored by</h5>
99        <img src="/images/joyent-footer.svg" width="200">
100        <p class="tag">Production Node +<br>High Performance Infrastructure</p></a>
101        <a href="https://my.joyent.com/landing/signup/701800000015696" class="button getstarted">Get Started</a>
102      </div>
103      <div class="foot-2">
104        <div class="foot-nav">
105          <ul>
106            <li><a href="http://nodejs.org/download/">Downloads</a></li>
107          </ul>
108          <ul>
109            <li><a href="http://nodejs.org/documentation/">Documentation</a></li>
110            <li><a href="http://nodejs.org/documentation/api/">API Docs</a></li>
111            <li><a href="http://nodejs.org/documentation/tutorials/">Tutorials</a></li>
112            <li><a href="http://nodejs.org/documentation/localization/">Localization</a></li>
113          </ul>
114          <ul>
115            <li><a href="http://nodejs.org/community/">Community</a></li>
116            <li><a href="https://github.com/joyent/node/issues">Github Issues</a></li>
117            <li><a href="http://groups.google.com/group/nodejs">Mailing List</a></li>
118            <li><a href="http://webchat.freenode.net/?channels=node.js">IRC</a></li>
119            <li><a href="https://twitter.com/nodejs">Twitter</a></li>
120          </ul>
121          <ul>
122            <li><a href="http://nodejs.org/about/">About</a></li>
123            <li><a href="http://nodejs.org/about/organization/">Organization</a></li>
124            <li><a href="http://nodejs.org/about/core-team/">Core Team</a></li>
125            <li><a href="http://nodejs.org/about/resources/">Resources</a></li>
126          </ul>
127          <ul>
128            <li><a href="http://blog.nodejs.org">Blog</a></li>
129          </ul>
130        </div>
131        <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>
132      </div>
133    </div>
134
135    <script src="sh_main.js"></script>
136    <script src="sh_javascript.min.js"></script>
137    <script>highlight(undefined, undefined, 'pre');</script>
138
139    <script>
140      window._gaq = [['_setAccount', 'UA-10874194-2'], ['_trackPageview']];
141      (function(d, t) {
142        var g = d.createElement(t),
143            s = d.getElementsByTagName(t)[0];
144        g.src = '//www.google-analytics.com/ga.js';
145        s.parentNode.insertBefore(g, s);
146      }(document, 'script'));
147      ;(function(d,n) {
148        var os = n.platform.match(/(Win|Mac|Linux)/);
149        var x = n.userAgent.match(/x86_64|Win64|WOW64/) ||
150                n.cpuClass === 'x64' ? 'x64' : 'x86';
151        var base = 'http://nodejs.org/dist/v0.10.30/';
152        var href = 'node-v0.10.30.tar.gz';
153        var db = d.getElementById('downloadbutton');
154        var d2;
155        switch (os && os[1]) {
156          case 'Mac':
157            href = 'node-v0.10.30.pkg';
158            break;
159          case 'Win':
160            href = 'node-v0.10.30-' + x + '.msi';
161            if (x === 'x64') href = 'x64/' + href;
162            break;
163
164          // TODO uncomment when we have these
165          // case 'Linux':
166          //   // two buttons: .deb and .rpm
167          //   href = 'node-v0.10.30-' + x + '.rpm';
168          //   var d2 = document.createElement('a');
169          //   d2.href = base + 'node-v0.10.30-' + x + '.deb';
170          //   d2.className = 'button downloadbutton';
171          //   d2.innerHTML = 'INSTALL .deb';
172          //   db.innerHTML = 'INSTALL .rpm';
173          //   db.parentNode.insertBefore(d2, db);
174          //   break;
175        }
176
177        db.href = base + href;
178        // if there's one download option, then download it at #download
179        if (location.hash === '#download' && !d2)
180          location.replace(b.href);
181      })(document,navigator);
182    </script>
183 </body>
184</html>
185