adds code


After Login into Node JS Chat Application with MongoDB Database, now we want to validate that user is login or not under this Chat Application. So in this video tutorial, we will show you how to fetch login user data from browser local storage and send this data to server script by using Fetch API and under this we will send JWT token data via HTTP header, and at server side we have to make one middleware which will fetch JWT token from HTTP header and then after it will decode JWT token data and fetch user id from that token and then after we will make one route in which it will call that middleware which will return user id and based on that it will fetch that user id data from MongoDB database and then after it will send data to client in JSON format and lastly display user profile data on web page. So when user has been login into system then it will send fetch API required for fetch user data from MongoDB database and then after it will display user name and image data on web page and it will store user data at client side in local variable also. For Source Code & Online Demo - https://www.webslesson.info/2024/05/building-a-real-time-chat-application-project-in-node-js-with-mongodb.html
Previous Post Next Post