Coder Social home page Coder Social logo

hapi-session-mongo's People

Contributors

mkoopajr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hapi-session-mongo's Issues

Simpler If/or statements

This code could be written simpler

module.exports = function(options) {
    options = options || {}; // ensures that options is not undefined
    var ip = options.ip || '127.0.0.1', // very simple || works here
        port = options.port || 27017,
        dbName = options.db || 'test',
        dbUser = options.name, // no need for undefined, it's undefined if it's undefined :)
        dbPwd = options.pwd
        ssl = options.ssl, // false not required here, undefined is falsey and should work
        ttl = options.ttl || 0;

errback style always

This is errback style

foo(function(err, data) {
    if (err) {
         return callback(err);
    }
   //Proceed with happy path logic
});

Instead of callback(false) use callback(null). null means it's ok
Instead of callback(true) use callback(err). err allows the user to respond to the actual error

If you are generating an error, as in invalid config or something use:
callback(new Error('you did something wrong'))

Code:

Testing on Travis

When you are testing you will want to set this up on TravisCI.

You will need to create a shell script that will install MongoDB and prep it with dummy users. The setup the ENV variables and start the tests.

Bunch of docs here: http://docs.travis-ci.com/user/languages/javascript-with-nodejs/

Once that's hooked up (you have to make this repo public before that) you need to also add a section to the readme about testing, etc..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.