nodejs learning path
audio file wav collecting, piecing together
- docker-compose.yml
- volumes: binding local/host dir to container's dir
- network_mode: 'host' (container share same IP with host, and that's what I need here)
- nginx' default.conf
- which is loaded by niginx main conf, so just modifiy this one.
- express middleware: CORS, exception,
- persist mongoose: validator, ref, populate
- model: Product, Order
-
passport middleware for authentication
-
Admin with Cookie
- Since version 1.5.0, the cookie-parser middleware no longer needed by express-session
- Passport is middleware of Express, while passport-local is strategy middleware of Passport.
- passport-local default uses { username, password }, and stored in memory - restart server cleans everything inside.
-
Admin with jsonwebtoken
- res.cookie('jwt', token, { httpOnly: true }) // If client browser automatically deal with it
- res.json({ success: true, token: token }) // If client prefer use authorization headers
-
model: User
- unique username validator:
(1) isUnique can't use in lambda => wrong capturing "this", use in function! (2) _id is Object ref, === compare always false! comparing by String(doc1._id) === String(doc2._id) - bcrypt: hashing password
- unique username validator:
-
find-grained access
-