I started with monk instead of mongoose - and I really would be happy to stay this way!
My concrete problem: How to transfer or better 'adapt' this following functionalities - that exists in a lot of node/mongoose/passport.js tutorials - with monk?
This is the snippet for mongoose:
// app/models/user.js
var mongoose = require('mongoose');
var bcrypt = require('bcrypt-nodejs');
// define the schema for our user model
var userSchema = mongoose.Schema({..})
// generating a hash
userSchema.methods.generateHash = function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);};
// checking if password is valid
userSchema.methods.validPassword = function(password) {
return bcrypt.compareSync(password, this.local.password);};
// create the model for users and expose it to our app
module.exports = mongoose.model('User', userSchema);
Well I have a monk schema already, but how to go on? Could anybody gives me a hint to have an equivalent for the two bcrypt functionalities and model creation & backpassing with monk?