Today we will see how to upload image in NodeJS and save image name in DB.

We have multiple way of uploading images i.e. upload images at third party storage i.e. cloudinary, AWS S3 bucket etc, store images in DB as BLOB or keep images in a folder of our project and store image name in DB. It’s a debate which option is good. Personally I prefer to store at third party storage, but here we will keep image in our project and store name of image in DB.

Technologies which we will be using here: NodeJS, Express, Angular, MongoDB

We have many time got such requirement as a software developer to send some notification in real time. Today I will show some basics of how to achieve the same.

We will use NodeJS, Angular, Express and Socket.io to achieve real time notification.

Before we start let’s clear some terminology for socket.io/eventEmmiter

What Socket.IO is

Socket.IO is a library that enables real-time, bidirectional and event-based communication between the browser and the server.

emit: Send the event

on: Listen for the event

Let’s start with backend first

Create a node service or use any existing service if have any. (I am not showing how…

Interceptor can help us to inspect and transform (Modify) HTTP request from our application to server. It can also help to inspect and transform (Modify) server’s response back to our application. Multiple interceptors form a forward-and-backward chain of request/response handlers.

Interceptors can perform a variety of implicit tasks, from authentication to logging, in a routine, standard way, for every HTTP request/response. Without interception, developers would have to implement these tasks explicitly for each HttpClient method call.

How to generate an interceptor

After creating angular project use below command to generate an interceptor at the location in your app where you want to generate it

ng…

What is NoSQL injection? How it is working? How to prevent it?

What is NoSQL injection?

A NoSQL injection vulnerability is an error in a web application that uses a NoSQL database. This web application security issue lets a malicious party bypass authentication, extract data, modify data, or even gain complete control over the application. NoSQL injection attacks are the result of a lack of data sanitization.

NoSQL injections are just one of many injection attacks, similar to traditional SQL Injections. They are engineered to exploit modern databases that do not use SQL. …

What is middleware?

Middleware functions are functions that have access to the request object (req), the response object (res), and the next function in the application’s request-response cycle. The next function is a function in the Express router which, when invoked, executes the middleware succeeding the current middleware.

As per it’s name, middleware comes in the middle of the request-response cycle.

What is request-response cycle?

When any client/user request any data from server to till the client/user get the final response, this whole process known as the request-response cycle.

What middleware can do?

  • Execute any operation coded in the method.
  • Make changes to the request and the response objects.
  • End the…

Hetaram Prajapati

I am a MEAN stack developer with 3+ years of experience working with one of the most innovative talent product and platform company SCIKY.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store