Apply Javascript styleguide

This commit is contained in:
Jonathan Cremin 2015-08-23 22:12:32 +01:00
parent 752ce964c8
commit 6e0f351093
30 changed files with 364 additions and 375 deletions

View file

@ -5,7 +5,7 @@ const debug = debugname('hostr:mongo');
const uristring = process.env.MONGO_URL || process.env.MONGOLAB_URI || 'mongodb://localhost:27017/hostr';
let configuredClient = new Promise(function (resolve, reject) {
const configuredClient = new Promise((resolve, reject) => {
debug('Connecting to Mongodb');
return MongoClient.connect(uristring).then((client) => {
debug('Successfully connected to Mongodb');
@ -20,19 +20,19 @@ let configuredClient = new Promise(function (resolve, reject) {
client.ObjectId = mongodb().ObjectId;
return resolve(client);
}).catch((e) => {
reject(e)
reject(e);
});
}).catch((e) => {
debug(e);
});
export default function() {
return function* (next) {
return function* dbMiddleware(next) {
try {
this.db = yield configuredClient;
} catch (e) {
debug(e);
}
yield next;
}
};
}