Permalink
Browse files

Serve static files from a 'public' dir.

Moved js out of html.
  • Loading branch information...
1 parent 7ede81c commit 86b89aa3c0673bf99fa7a61b91a0d672e087fbe7 @jollytoad committed Sep 28, 2011
Showing with 9,071 additions and 22 deletions.
  1. +6 −3 app.js
  2. +2 −19 index.html
  3. +9,046 −0 public/jquery.js
  4. +17 −0 public/socket.js
View
9 app.js
@@ -1,6 +1,9 @@
-var net = require("net");
-var app = require("express").createServer();
-var io = require("socket.io").listen(app);
+var net = require("net"),
+ express = require("express"),
+ app = express.createServer(),
+ io = require("socket.io").listen(app);
+
+app.use(express.static(__dirname + "/public"));
app.listen(8081);
View
@@ -2,26 +2,9 @@
<html>
<head>
<title>WebSocket Proxy</title>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
+ <script src="jquery.js"></script>
<script src="/socket.io/socket.io.js"></script>
- <script>
- $(function() {
- var socket = io.connect('http://localhost:8081');
-
- socket.on('msg', function (data) {
- console.log(data);
- $("<li/>").text(data).appendTo("#in");
- });
-
- $("#form").bind("submit", function(event) {
- var msg = $("#msg").val() + "\r\n";
- socket.emit('msg', msg);
- $("<li/>").text(msg).appendTo("#out");
- $("#msg").focus().val("");
- return false;
- });
- });
- </script>
+ <script src="socket.js"></script>
</head>
<body>
<h1>WebSocket Proxy</h1>
Oops, something went wrong.

0 comments on commit 86b89aa

Please sign in to comment.