We have been developing many nodejs applications and thought to share packages we found to be part of most of nodejs applications.
Express is framework for nodejs which is allowed to set up middlewares and define routing to handle HTTP request. It has great support and a bunch of helpful features.
$ npm install express --save
This package is useful for managing session in nodejs. By default session data store in RAM but we can store in database like radis, MongoDB etc.
$ npm install express-session --save
If session data store in ram in production, it will give an error like “Warning: connection.session() MemoryStore is not designed for a production environment, as it will leak memory, and will not scale past a single process.
In order to save session data into the database, we need to use packages. We recommend to store session data into radis DB and for that, you need to use Connect-redis package to connect redis db with express session.
$ npm install connect-redis --save
The path module is essential for working with file and directory paths. You can do path manipulation easily using helper functions. Eg: To find file path exist or not, join path, file basename etc. with this package.
$ npm install path --save
$ npm install body-parser --save
Express-validation helps to validate rules in body, params, cookies, header and query for requests and give a response with errors in case of validation failure.
$ npm install express-validator --save
We recommend using nodemailer for sending emails in nodejs application. It works with SMTP and Sendmail as well as it’s Unicode friendly.
$ npm install nodemailer --save
It is useful to add activity logs like request URL, request method, request parameters, request IP in MongoDB.
$ npm install mongo-morgan --save
It is useful for adding debug and uncatch exceptional error logs into a file. It supports multiple transports.
$ npm install winston--save
This module helps to add log error or other types of activity in MongoDB.
$ npm install winston-mongodb --save