On Saturday, March 24, 2012 12:56:00 PM UTC+1, Eldar wrote:
>
> No it's not hardcoded. I'll try to be more clear.
>
> Lets implement auth module as follows:
>
> auth/auth.js
> auth/test.js
> auth/index.js
>
> //auth/auth.js
> module.exports = function setup (users) {
>   return  function authenticate (email, password, cb) {
>     // using user repo here
>   }
> }
>
> //auth/test.js
> var users = require('user-repo-stub')
> var auth = require('./auth')(users)
> // tests go here
>

Thanks Eldar, this looks like what I've got today except the setup function 
returns an object with multiple functions since the auth.js file includes 
functions for more than just authentication (like registering users).

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to