Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[minor] Added support for custom pathnames in the example.

  • Loading branch information...
commit 53a57b3fd59862a285162f038ca5003b15bc982c 1 parent 1963e92
@3rd-Eden 3rd-Eden authored
Showing with 9 additions and 3 deletions.
  1. +1 −1  example/echo/index.html
  2. +8 −2 example/echo/index.js
View
2  example/echo/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Primus</title>
- <script src="/primus/primus.js"></script>
+ <script src="/primus.js"></script>
<link rel="stylesheet" href="//getbootstrap.com/dist/css/bootstrap.css" />
<style type="text/css">
.jumbotron { background: #73146E; color: #FFF }
View
10 example/echo/index.js
@@ -34,13 +34,19 @@ var http = require('http')
//
server = http.createServer(function server(req, res) {
res.setHeader('Content-Type', 'text/html');
- fs.createReadStream(__dirname + '/index.html').pipe(res);
+ fs.createReadStream(
+ __dirname + (~req.url.indexOf('primus.js') ? '/primus.js' : '/index.html')
+ ).pipe(res);
});
//
// Now that we've setup our basic server, we can setup our Primus server.
//
-primus = new Primus(server, { transformer: argh.transformer, parser: argh.parser });
+primus = new Primus(server, {
+ transformer: argh.transformer,
+ parser: argh.parser,
+ pathname: argh.pathname || '/primusexample'
+});
//
// Listen for new connections and send data
Please sign in to comment.
Something went wrong with that request. Please try again.