Skip to content

costinEEST/node-cookbook

Repository files navigation

Event's name Event's description
close Emitted when the stream and any of the stream's resources have been closed. No further events will be emitted
data Emitted when new data is read from the stream
end Emitted when all available data has been read
error Emitted when the readable stream experiences an error
pause Emitted when the readable stream is paused
readable Emitted when there is data available to be read
resume Emitted when a readable stream resumes after being in a paused state
  • Events emitted on writable streams:
Event's name Event's description
close Emitted when the stream and any of the stream's resources have been closed. No further events will be emitted
drain Emitted when the writable stream can resume writing data
error Emitted when the writeable stream experiences an error
finish Emitted when the writeable stream has ended and all writes have completed
pipe Emitted when the stream.pipe() method is called on a readable stream
unpipe Emitted when the stream.unpipe() method is called on a readable stream
  • An overview of HTTP
  • Postman Echo is a service you can use to test your REST clients and make sample API calls
  • HTTP status codes
  • To check if a SMTP server is listening on port 4321 use either telnet localhost 4321 or nc -v localhost 4321
  • Prefer netcat instead of telnet
  • List the contents of your node_modules directory: npm list
  • To see where the formidable package was installed type which formidable or where formidable (for Windows)
  • GitHub's default .gitignore file for Node.js
  • npm's semver ranges
  • Differences between ES modules and CommonJS
  • Scaffold an Express.js application: npx express-generator --view=ejs express-generated-app
  • async syntax landend in Node.js 7.6.0
  • Fastify vs Express: which is better?
  • Generate a Fastify application from the command line: npx fastify-cli generate fastify-generated-app
  • Install Docker inside of WSL
  • List Docker containers: docker ps
  • Stop a Docker container: docker stop containerID
  • Remove a Docker container: docker rm --force containerID
  • Remove all Docker containers: docker rm --force $(docker ps --all --quiet)
  • Start a MySQL v8 database listening on port 3306: docker run --publish 3306:3306 --name node-mysql --env MYSQL_ROOT_PASSWORD=PASSWORD --detach mysql:8.0
  • Connect to MySQL from Node.js using mysql2 package
  • Start a PostgreSQL v14.5 database listening on port 5432: docker run --publish 5432:5432 --name node-postgres --env POSTGRES_PASSWORD=PASSWORD --detach postgres:14.5
  • The pg module automatically looks for specifically named variables (PGPORT, PGPASSWORD, and PGUSER)
  • Builtin PostgreSQL types with stable OID
  • Start a MongoDB v4.2.22 database listening on port 27017: docker run --publish 27017:27017 --name node-mongo --detach mongo:4.2.22
  • Start a Redis v7.0.4 database listening on port 6379: docker run --publish 6379:6379 --name node-redis --detach redis:7.0.4
  • Start a password protected Redis database listening on port 6380: docker run --name node-redis-pwd -d -p 6380:6379 redis redis-server --requirepass PASSWORD
  • How to use Redis with Node.js
  • Redis cheat sheet with the most needed stuff
  • Replace redis with ioredis
  • Implement caching in Node.js Using Redis
  • LevelDB workshop
  • LevelDB playlist by BlessYahu
  • LevelDB playlist by Wei Zhou
  • tape assertion methods
  • Trust proxy configuration for Express.js