Tutorials to learn node.js
The module system for example has played an important role in the ES6 modules adoption. Indeed modules (require in node.js) are so convenient and natural to split the code in different files.
- OS module : operation system related function
- Using Request library https://blog.risingstack.com/node-hero-node-js-request-module-tutorial
How to use promises instead of callback and even transform core modules in promise style
- Using ES6 promises implementation of a library (blue bird, q….)
How to get node backend faster
Simple server side cache for express js (using memory-cache) https://goenning.net/2016/02/10/simple-server-side-cache-for-expressjs/
The node debugger that use chrome debugger is available in latest version of node using the –inspect flag
$ node --inspect index.js Debugger listening on port 9229. Warning: This is an experimental feature and could change at any time. To start debugging, open the following URL in Chrome: chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/b4f005c7-caad-4e7c-b554-5746da12b549 Server listening on 3000 Debugger attached.
- Simple test with mocha and chai tutorial
Inspire from existing library
You will probably use many open source library in your project. Why not opening a dedicated tab or window in your text editor to browse the code. It could be very instructive to how to organize code in node.js.
Read and write files with fs
var src = fs.createReadStream(req.files.path); var target_path = '.tmp/' + req.file.originalname + '.xls'; var dest = fs.createWriteStream(target_path);