I am at class 27 and today’s modules have been:
- Custom queries and hooks (checking and saving unique
slugs, compound mongoose aggregations,Promise.all) - User accounts and auth (defining a user/pw schema with passport.js, auth protecting routes, account updating, forgot password)
nonobvious things to note:
- using
this.constructor.find()in aschema.pre('save')function as it is not yet instantiated - adding custom
staticsmethod in a schema withthis.aggregate([{$unwind:'$tags'},{group, sort etc...}]) - supplying the edge case of no query in a search with
{$exists: true} - how to make middleware to validate registration with
validator.sanitizeBody,checkBody, andnormalizeEmail’ - how to use
es6-promisifyto make User.register (frompassport-local-mongoose) promised - how to properly setup an
authControllerStrategy for passport at theapp.jslevel - userschema virtual field and GRAVATAR GRABBING
cryptomodule in node!!!