Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Comment out socket.io script in index.html by default

  • Loading branch information...
commit 1f43c3780e346b9a72ad31d38fddf0c5d9094953 1 parent 71ce721
@ccoenraets authored
Showing with 13 additions and 16 deletions.
  1. +8 −7 public/index.html
  2. +5 −9 routes/wines.js
View
15 public/index.html
@@ -27,13 +27,14 @@
<script type="text/javascript" src="socket.io/socket.io.js"></script>
<script>
- var socket = io.connect();
- socket.on('connect', function () {
- socket.send(window.location.href);
- });
- window.onhashchange = function () {
- socket.send(window.location.href);
- }
+// UNCOMMENT THIS CODE IF YOU USE THE "serverwithanalytics" SERVER
+// var socket = io.connect();
+// socket.on('connect', function () {
+// socket.send(window.location.href);
+// });
+// window.onhashchange = function () {
+// socket.send(window.location.href);
+// }
</script>
</head>
View
14 routes/wines.js
@@ -1,15 +1,14 @@
var mongo = require('mongodb');
var Server = mongo.Server,
+ Db = mongo.Db,
BSON = mongo.BSONPure;
-var mongoUri = process.env.MONGOLAB_URI || "mongodb://localhost/winedb?auto_reconnnect"
+var server = new Server('localhost', 27017, {auto_reconnect: true});
+db = new Db('winedb', server, {safe: true});
-var db = null;
-
-mongo.connect(mongoUri, {}, function(err, database) {
+db.open(function(err, db) {
if(!err) {
- db = database;
console.log("Connected to 'winedb' database");
db.collection('wines', {safe:true}, function(err, collection) {
if (err) {
@@ -18,9 +17,6 @@ mongo.connect(mongoUri, {}, function(err, database) {
}
});
}
- else {
- console.log("COULD NOT CONNECT TO MONGO: " + mongoUri);
- }
});
exports.findById = function(req, res) {
@@ -317,4 +313,4 @@ var populateDB = function() {
collection.insert(wines, {safe:true}, function(err, result) {});
});
-};
+};
Please sign in to comment.
Something went wrong with that request. Please try again.