How to properly handle Node express graceful shutdown

If you’re building something in backend using Node.js, There’s a good chance that you’re using express.js. Express.js is most popular http framework know for being fast, unopinionated, and feature complete library. One thing developers need to handle properly when using express with process managers like pm2, forever etc, when these process managers send shutdown signal, … Read more

Use express.js with nuxt.js

Express.js in one of the most popular Node.js framework, so if you’re working with Nuxt.js and want to use it with express.js because you want user express.js capabilities with nuxt.js, in this quick tutorial we will learn how to use nuxt.js with express.js. Using Nuxt.js middleware with express.js Nuxt.js provides nuxt.render middleware to use it … Read more

Use Global Node Modules in Normal Nodejs App/Script

If you’re developing a small node script based on global node_module that you have installed, Once you import or require that particular node_module, You will see that Node.JS runtime will throw error module not found error, It is basically because your Node app doesn’t have access to globally installed node_modules, but thanks to vibrant Node.js … Read more

Fix HPE_INVALID_METHOD Error in Node.JS (Hapi/Fastify/Express)

Node.JS images, logo

When You’re Making HTTP request in Node.JS Server Written In Node.JS Rest API Frameworks such Express.js, Hapi.js, Fastify.js and Many more, Suddenly, you encounter error “parse Error: Invalid method encountered”, “stack”: Error: Parse Error: Invalid method encountered “bytesParsed”: 0, “code”: “HPE_INVALID_METHOD””, Don’t Panic it’s very not any programming mistake, rather simple typo mistake. Fix:What you’re … Read more

Find the host’s cloud provider using Node.Js

If you ever wanted to inject or use cloud provider-specific code in the codebase or DevOps work, You can now do it very easily thanks to cloud-detect-js(https://github.com/vithalreddy/cloud-detect-js#readme) Node.js Module, which helps to determine host machine’s cloud provider using machine’s file system and metadata. Detect Host’s Cloud Provider This Module Provides a very simple API as … Read more

How to run shell script file or command using Nodejs?

nodejs npm

If you ever wanted to run some automation script or file in your Unix/Linux machine using nodejs? It may be to build your binaries from source code or for some tooling in your dev workflow. Nodejs Provides well-matured APIs for doing these operations and there are plenty of npm modules to ease the pain creating … Read more

Push and Pop Items Into MongoDB Array Via Mongoose in Node.js

mongoDB Monoogse Schema

How To Push or Pop Items Into MongoDB Document Array Via Mongoose in Node.js (Express.js)   If you’re Developing your Rest API’s using Node.js or Express.js, Then You’re probably using MongoDB as Database for Storing Data and Probably with mongoose ODM for working with MongoDB Database.Now as you’re DB starts to grow and you have multiple … Read more