Advanced interview questions for web application server-side/ back-end developers, Node.js – Part1

Here are some interview questions that Lead backend developers, with experience of  3+ years, usually face during interviews. QUESTIONS What are authentication and authorization? What is OAuth? What are API gateways and advantages of using them? Which is the best place to store session_ids or access_tokens. What are the different types of client-side storages and their differences?  What are middlewares? What is CORS(Cross-origin resource sharing), what is the importance and how to handle CORS? Describe microservices, web services, and APIs? How to validate requests while building REST APIs and why it is important? Explain the difference between SQL databases and NoSQL databases? Explain callbacks We have foreach loop and in each, we will have asynchronous operations. How to handle this case? ANSWERS Authentication is about verifying user identity and authorization is about checking whether a resource can be accessed. Authorization is not about user identity, it is about whether a requester can be granted permission to access a resource. Authentication is about verifying a user’s identity. Authentication and authorization are used together for providing security to a system. Here is a very useful article to learn the differences between authentication and authorization. This article also explains how these two are…

Understanding Promises in JavaScript : asynchronous behaviour of Javascript Part -2

In the previous article, we learned about using callback for performing asynchronous operations. In ES06/ES2015, Javascript introduced something called Promises which helps you handle  asynchronous operations in a better way The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value. Promises provide a better way for managing asynchronous operations when compared to traditional callback-based way. Promises represent data that may not be available but will be available later upon completing some asynchronous operation. A promise can be called a placeholder for future data and  has 3 states PENDING RESOLVED REJECTED Immediately on creation, the state of a Promise is pending. Resolved state means the asynchronous operation is fulfilled. Rejected means that the asynchronous operation is not completed and has some errors. Many Javascript native apis for asynchronous operations support promises since ES06. Prior to that many libraries including JQuery and Bluebird were used to create promises for doing asynchronous operations. Example for promises JavaScript fetch method returns a promise.

You can see that immediately the state of promise is pending. Now for resolving the promise and getting the output Promise.prototype.then() and Promise.prototype.catch() Promise.prototype.then() and Promise.prototype.catch() The promise object has a then method that returns the promise…

Share this page in social media platforms