Middleware

Middleware is used to share data from the client side to the server side.It is also used for authentication and authorization. authentication means verifying user credentials like username or email and password which is saved in the database if exists .authorisation means access to resources that is who can read, write and delete the content or the post if I am a user first authentication takes place i.e-validation after that authorization which species if the user is logged he can access his resources as well others if authorized.To transmit data from client to server we use middleware like express.json() which converts the data into JSON format so that it is easily transmitted and readable we also use other middleware to encode data for security purposes and middleware like auth for authentication and payments.