ignore certain fields from mongoose schema when return object to client

override the toJSON This will remove the password part in the target object. documented way The mongoose document is in the toOject() part toJson doc The mongoose document which is being converted ret The plain object representation which has been converted options The options in use (either schema options or the options passed inline) use…

window sessionStorage vs localStorage

They are almost the same. However if you want to store info beyond a tab, which means even after a tab is closed, then use localStorage Opening a page in a new tab or window will cause a new session to be initiated. That means that info stored in sessionStorage can’t share between tabs. more details could be…

authentication angular nodejs with JWT

Why use it? Here are some advantages of choosing JWT: Standard: JWT is becoming a standard, and there a multiple libraries for a lot of languages (Ruby, Java, Python, Node, Backbone). So the integration with your language or technology should be pretty easy. Cross-domain / CORS: Since the information is transmitted using an HTTP header, you are…

.profile vs .bash_profile in OSX

According to the manual page that ships with OS X: … it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The –noprofile option may be used when the shell is started to inhibit this behavior. in summary: .profile works with sh…