Permalink
Browse files

reproduces jdesboeufs/connect-mongo#80 - see error.log

  • Loading branch information...
techjeffharris committed Dec 18, 2014
0 parents commit 901e041b41ef55da60f41ea6f481ec3ed2d39963
Showing with 2,024 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +1,417 −0 error.log
  3. +44 −0 gen-key-cert.sh
  4. +26 −0 package.json
  5. +92 −0 public/client.js
  6. +264 −0 server.js
  7. +23 −0 ssl.js
  8. +8 −0 views/errors/404.jade
  9. +9 −0 views/errors/500.jade
  10. +3 −0 views/errors/layout.jade
  11. +63 −0 views/layout.jade
  12. +25 −0 views/logon.jade
  13. +16 −0 views/protected.jade
  14. +25 −0 views/register.jade
  15. +7 −0 views/root.jade
@@ -0,0 +1,2 @@
node_modules
.ssl/
1,417 error.log

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,44 @@
#!/bin/bash
# require root
# if [ $USER != "root" ]
# then
# echo "$0: error: must be root" && exit 2
# fi
# if the length of $1 is not zero
if [ $1 ]
then
# set serverName to $1
serverName=$1
else
# set serverName to default: "connect-mongo-test"
serverName="connect-mongo-test"
fi
# ouput the server name to be used
#echo "server name: $serverName"
# create .ssl/ if it doesn't exist
if [ ! -d .ssl ]
then
mkdir .ssl
fi
key=".ssl/$serverName-key.pem"
csr=".ssl/$serverName-csr.pem"
cert=".ssl/$serverName-cert.pem"
echo "generating key $key...";
openssl genrsa -out $key
echo "generating request $csr..."
openssl req -new -key $key -out $csr
echo "self-signing certificate $cert..."
openssl x509 -req -days 9999 -in $csr -signkey $key -out $cert
echo "deleting request $csr..."
rm $csr
echo "successfully generated key $key, and self-signed cert $cert from request $csr."
@@ -0,0 +1,26 @@
{
"name": "connect-mongo-ttl-error-example",
"version": "0.0.0",
"description": "attempt to recreate Error setting TTL index on collection #80",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "",
"license": "BSD-2-Clause",
"dependencies": {
"connect-flash": "~0.1.1",
"cookie-parser": "~1.3.3",
"passport.socketio": "~3.4.1",
"passport-local-mongoose": "~1.0.0",
"passport": "~0.2.1",
"serve-static": "~1.7.1",
"express-session": "~1.9.3",
"express": "~4.10.6",
"socket.io": "~1.2.1",
"connect-mongo": "~0.4.1",
"mongoose": "~3.8.20",
"debug": "~2.1.0"
}
}
@@ -0,0 +1,92 @@
$(document).ready(function documentReady () {
var client = io();
client.on('connect', onConnect);
client.on('disconnect', onDisconnect);
client.on('chat', chat_addToLog);
client.on('joined', chat_joined);
client.on('left', chat_left);
$('#chat_input').on('keyup', function (event) {
if (event.keyCode === 13) {
chat_send();
}
});
$('#chat_submit').on('click', function (event) {
chat_send();
});
function chat_addToLog (displayName, msg) {
// get the existing message
var existing = $('#chat_log')[0].value;
// and set the value to the existing chat content plus the new message at the end
$('#chat_log')[0].value = existing + '\n' + new Date() + ' [' + displayName + ']: ' + msg;
$('#chat_log')[0].scrollTop = $('#chat_log')[0].scrollHeight;
};
function sysMsg (msg) {
chat_addToLog('SYSTEM', msg);
};
function chat_joined (displayName) {
sysMsg(displayName + ' joined');
};
function chat_left (displayName) {
sysMsg(displayName + ' left');
};
function chat_send () {
var msg = $('#chat_input')[0].value;
client.send(msg);
$('#chat_input')[0].focus();
$('#chat_input')[0].select();
};
function enable_chat () {
$('#chat_input').prop('disabled', false);
$('#chat_submit').prop('disabled',false);
};
function disable_chat () {
$('#chat_input').prop('disabled', true);
$('#chat_submit').prop('disabled', true);
};
function onConnect () {
var msg = 'connection established!';
console.log(msg);
sysMsg(msg);
enable_chat();
};
function onDisconnect () {
var msg = 'connection lost!';
console.log(msg)
sysMsg(msg);
disable_chat();
};
function onError (err) {
console.log(err);
sysMsg(err);
};
function onChat (socketId, msg) {
chat_addToLog(socketId, msg);
};
});
Oops, something went wrong.

0 comments on commit 901e041

Please sign in to comment.