snipt

Ctrl+h for KB shortcuts

JavaScript

wikistream-server.js

1
2
3
4
5
6
7
8
var express = require("express");
var sio = require("socket.io");

var app = express.createServer();

// set up the webapp routes, templates and whatnot

var io = sio.listen(app);
https://snipt.net/embed/c92b55214ed05af693f73b138cd92313/
/raw/c92b55214ed05af693f73b138cd92313/
c92b55214ed05af693f73b138cd92313
js
JavaScript
9
2019-08-23T06:46:38
True
False
False
Jul 10, 2012 at 04:02 PM
/api/public/snipt/43728/
wikistream-serverjs
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">var</span> <span class="nx">express</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s2">&quot;express&quot;</span><span class="p">);</span> </span><span id="L-2"><a name="L-2"></a><span class="kd">var</span> <span class="nx">sio</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s2">&quot;socket.io&quot;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="kd">var</span> <span class="nx">app</span> <span class="o">=</span> <span class="nx">express</span><span class="p">.</span><span class="nx">createServer</span><span class="p">();</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="c1">// set up the webapp routes, templates and whatnot</span> </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a><span class="kd">var</span> <span class="nx">io</span> <span class="o">=</span> <span class="nx">sio</span><span class="p">.</span><span class="nx">listen</span><span class="p">(</span><span class="nx">app</span><span class="p">);</span> </span></pre></div> </td></tr></table>