-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNode-Cheat-Sheet.txt
More file actions
79 lines (55 loc) · 2.75 KB
/
Node-Cheat-Sheet.txt
File metadata and controls
79 lines (55 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
* Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser.
* Node.js is a run-time JavaScript environment built on top of Chrome’s V8 engine. It uses an event-driven, non-blocking I/O model. It is lightweight and so efficient. Node.js has a package ecosystem called npm.
* Node.js (or JavaScript) is a single-threaded, event-driven language.
* REPL means Read-Eval-Print-Loop. It is a virtual environment that comes with Node.js. We can quickly test our JavaScript code in the Node.js REPL environment.
* In Node js every file is a moule. And every Node Js App contains at least one main module which is route module.
* Node JS keeps the events in stack.
* Asynchronous programming means - In Node js, any event takes much time, it will be in stack and callback function wil be triggered after event completion.
* In browser we can use 'window' & 'document' objects. Whereas in Node we have 'global' & 'process'
* We can execute any JS file by running below command in terminal/CMD
node FILE-NAME.js
* It is possible to write synchronous way/code in Node JS. We can do that with 'fs.readFileSync' func.
* 'npx' comes with npm 5.2+ versions.
* We can use 'config' || 'dotenv' packages to utilise 'process.env'
*
****************************************** Common packages *********************************************
* express
* express-validator
* body-parser
* morgan
* nodemon
* config || dotenv
* multer
* nodemailer
* mongoose
* mysql
* jsonwebtoken
* bcryptjs
* passport
* uuid
* cookie-parser
* helmet
* cors
* pm2
* socket.io
* moment --> Use to format dates & time
*
****************************************** Status codes ************************************************
* 200 = Ok
* 400 = BAD_REQUEST
* 401 = Un-Authorized
* 403 = Forbidden
* 404 = Not Found
* 500 = INTERNAL_SERVER_ERROR
* https://www.npmjs.com/package/http-status-codes
*** https://www.npmjs.com/package/compress-images --> Nice Images compression Package
* https://www.npmjs.com/package/jimp --> Abit good Images compression Package
* https://medium.com/better-programming/how-to-use-node-js-workers-for-video-encoding-f1379d3933d0
* https://www.digitalocean.com/community/tutorials/how-to-add-advanced-photo-uploads-in-node-and-express
************************************ Useful links for Intervirew *************************************
* https://medium.com/@vigowebs/frequently-asked-node-js-interview-questions-and-answers-b74fa1f20678
*
************************************ Links which solved my errors *************************************
* https://stackoverflow.com/questions/48387040/nodejs-recommended-max-old-space-size/48392705
* https://stackoverflow.com/questions/36280818/how-to-convert-file-to-base64-in-javascript
*