{"id":73,"date":"2016-12-06T05:14:21","date_gmt":"2016-12-06T05:14:21","guid":{"rendered":"http:\/\/localhost\/techuz-new\/?p=73"},"modified":"2019-05-01T05:58:05","modified_gmt":"2019-05-01T05:58:05","slug":"essential-packages-for-node-js-application-development","status":"publish","type":"post","link":"https:\/\/www.techuz.com\/blog\/essential-packages-for-node-js-application-development\/","title":{"rendered":"Essential Packages for Node.js Application Development"},"content":{"rendered":"<p>We have been developing many <a href=\"https:\/\/www.techuz.com\/node-js-development\/\">nodejs applications<\/a> and thought to share packages we found to be part of most of nodejs applications.<\/p>\n<h2>1.Express framework<\/h2>\n<p>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.<\/p>\n<p><code>$ npm install express --save<\/code><\/p>\n<h2>2.Express-session<\/h2>\n<p>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.<\/p>\n<p><code>$ npm install express-session --save<\/code><\/p>\n<h2>3.Connect- redis<\/h2>\n<p>If session data store in ram in production, it will give an error like &#8220;Warning: connection.session() MemoryStore is not designed for a production environment, as it will leak memory, and will not scale past a single process.<\/p>\n<p>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.<\/p>\n<p><code>$ npm install connect-redis --save<\/code><\/p>\n<h2>4.Path<\/h2>\n<p>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.<\/p>\n<p><code>$ npm install path --save<\/code><\/p>\n<h2>5.Body-parser<\/h2>\n<p>Body-parser is an express middleware that extracts incoming request stream and stores it as a javascript object and exposes it on `req.body`.<\/p>\n<p><code>$ npm install body-parser --save<\/code><\/p>\n<h2>6.Express-validator<\/h2>\n<p>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.<\/p>\n<p><code>$ npm install express-validator --save<\/code><\/p>\n<h2>7.Nodemailer<\/h2>\n<p>We recommend using nodemailer for sending emails in nodejs application. It works with SMTP and Sendmail as well as it\u2019s Unicode friendly.<\/p>\n<p><code>$ npm install nodemailer --save<\/code><\/p>\n<h2>8.Mongo-morgan<\/h2>\n<p>It is useful to add activity logs like request URL, request method, request parameters, request IP in MongoDB.<\/p>\n<p><code>$ npm install mongo-morgan --save<\/code><\/p>\n<h2>9.Winston<\/h2>\n<p>It is useful for adding debug and uncatch exceptional error logs into a file. It supports multiple transports.<\/p>\n<p><code>$ npm install winston--save<\/code><\/p>\n<h2>10.Winston-MongoDB<\/h2>\n<p>This module helps to add log error or other types of activity in MongoDB.<\/p>\n<p><code>$ npm install winston-mongodb --save<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.techuz.com\/blog\/essential-packages-for-node-js-application-development\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Essential Packages for Node.js Application Development&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":1927,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"better_featured_image":{"id":1927,"alt_text":"","caption":"","description":"","media_type":"image","media_details":{"width":1200,"height":675,"file":"2016\/12\/nodejs-1-1.png","sizes":{"thumbnail":{"file":"nodejs-1-1-150x150.png","width":150,"height":150,"mime-type":"image\/png","source_url":"https:\/\/www.techuz.com\/blog\/wp-content\/uploads\/2016\/12\/nodejs-1-1-150x150.png"},"medium":{"file":"nodejs-1-1-300x169.png","width":300,"height":169,"mime-type":"image\/png","source_url":"https:\/\/www.techuz.com\/blog\/wp-content\/uploads\/2016\/12\/nodejs-1-1-300x169.png"},"medium_large":{"file":"nodejs-1-1-768x432.png","width":768,"height":432,"mime-type":"image\/png","source_url":"https:\/\/www.techuz.com\/blog\/wp-content\/uploads\/2016\/12\/nodejs-1-1-768x432.png"},"large":{"file":"nodejs-1-1-1024x576.png","width":1024,"height":576,"mime-type":"image\/png","source_url":"https:\/\/www.techuz.com\/blog\/wp-content\/uploads\/2016\/12\/nodejs-1-1-1024x576.png"},"blog_list":{"file":"nodejs-1-1-460x260.png","width":460,"height":260,"mime-type":"image\/png","source_url":"https:\/\/www.techuz.com\/blog\/wp-content\/uploads\/2016\/12\/nodejs-1-1-460x260.png"},"alm-thumbnail":{"file":"nodejs-1-1-150x150.png","width":150,"height":150,"mime-type":"image\/png","source_url":"https:\/\/www.techuz.com\/blog\/wp-content\/uploads\/2016\/12\/nodejs-1-1-150x150.png"},"twentyseventeen-thumbnail-avatar":{"file":"nodejs-1-1-100x100.png","width":100,"height":100,"mime-type":"image\/png","source_url":"https:\/\/www.techuz.com\/blog\/wp-content\/uploads\/2016\/12\/nodejs-1-1-100x100.png"}},"image_meta":{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0","keywords":[]}},"post":73,"source_url":"https:\/\/www.techuz.com\/blog\/wp-content\/uploads\/2016\/12\/nodejs-1-1.png"},"_links":{"self":[{"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/posts\/73"}],"collection":[{"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/comments?post=73"}],"version-history":[{"count":3,"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":4080,"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/posts\/73\/revisions\/4080"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/media\/1927"}],"wp:attachment":[{"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techuz.com\/blog\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}