Skip to content

Instantly share code, notes, and snippets.



Last active May 21, 2017
What would you like to do?
Nodejs general notes.
authoritative sources:
TODO (arguably) the wiki could use more material currently spread across the internet
injection/input escaping:
TODO what are the modules/strategies necessary for managing input that moves through the application
I prefer process.argv.forEach over packages, using the specific pattern --name=value
this doesn't make sense for certain types of product/end-user
1) node --inspect app.js --argvname=argvvalue // see argv comment
npm run debug -- --argvname=argvvalue
2) open chrome url chrome://inspect/ and click the link "Open dedicated DevTools for Node"
- 2017 May (Chrome changes regularly)
convention has just 3 environments
NODE_ENV = development | staging | production
These seem to be the only straightforward points to follow, otherwise profile your code.
* avoid fn.apply => prefer (or pass arguments) based on whatever is easy/clear
* avoid try/catch => eg for iterators (map/filter/forEach...) use it in caller instead;
* where needed I'm providing an alternate to use via a flag (in one case user needs to submit and see specifics for each)
* express's layer and promises appear to trigger a deoptimization (guessing due to try/catching errors, not my work so don't really care to look further)
memory usage:
TODO profiling, details ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.