We have been developing many nodejs applications and thought to share packages we found to be part of most of nodejs applications.
1.Express framework
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
2.Express-session
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
3.Connect- redis
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
4.Path
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
5.Body-parser
Body-parser is an express middleware that extracts incoming request stream and stores it as a javascript object and exposes it on `req.body`.
$ npm install body-parser --save
6.Express-validator
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
7.Nodemailer
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
8.Mongo-morgan
It is useful to add activity logs like request URL, request method, request parameters, request IP in MongoDB.
$ npm install mongo-morgan --save
9.Winston
It is useful for adding debug and uncatch exceptional error logs into a file. It supports multiple transports.
$ npm install winston--save
10.Winston-MongoDB
This module helps to add log error or other types of activity in MongoDB.
$ npm install winston-mongodb --save