Difference between revisions of "My Node.js notes"

From Got Opinion Wiki
Jump to navigation Jump to search
m (added NPM modules section and CORS module)
Line 25: Line 25:


== NPM modules ==
== NPM modules ==
[https://www.npmjs.com/package/cors CORS] is a node.js package for providing a Connect/Express middleware that can be used to enable [https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS CORS] with various options.
[https://www.npmjs.com/package/cors CORS] is a node.js package for providing a Connect/Express middleware that can be used to enable [https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS CORS] with various options.



Revision as of 17:36, 6 July 2019

Node.js Package Manager (npm)

npm

Initialize an npm project. Within project directory use npm init command. The default command launches a questionnaire. To answer default on all questions use -y argument.


Basic stuff

debugger statement and node inspect

chrome:://inspect

Exit Chrome DevTool debugger.

Type restart at console after exiting Chrome DevTool to restart app with same arguments.

Press CTRL+C twice to exit debugger in console.

nodemon

nodemon <app.name> -e <comma separated list of extensions to monitor>

nodemon src/app.js -e js,hbs

NPM modules

CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.

Resources

Node.js home

To software notes