Advertisement
satishfrontenddev5

Untitled

Feb 18th, 2024
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Q1. What is express?
  2. Q2. What is event loop?
  3. Q3. let arr = [1,2,4]
  4. arr.map(async (val) => {
  5.         Return a*2
  6. }
  7. What it will return?
  8. Q4. What is passcodejs?
  9. Q5. Types of server in express?
  10. Q6. Types of authorization like stateful and stateless?
  11. Q7. function Test(){
  12.         Return this
  13. }
  14. What it will return?
  15. Q8. What is middleware?
  16.  
  17. Sure, here are the answers to your questions in short and easy bullet points:
  18.  
  19. 1. **What is express?**
  20.    - Express is a minimalist web framework for Node.js used to build web applications and APIs quickly and easily.
  21.  
  22. 2. **What is event loop?**
  23.    - The event loop is a core concept in Node.js that allows asynchronous operations to be handled efficiently without blocking the execution of other tasks.
  24.  
  25. 3. **let arr = [1,2,4] arr.map(async (val) => { Return a*2 } What it will return?**
  26.    - It will return an array of promises because the callback function inside `map` is declared as `async`, causing each iteration to return a promise.
  27.  
  28. 4. **What is passport.js?**
  29.    - Passport.js is a popular authentication middleware for Node.js used to authenticate requests in web applications using various authentication strategies such as username/password, OAuth, and JWT.
  30.  
  31. 5. **Types of servers in express?**
  32.    - In Express.js, servers can be HTTP servers, HTTPS servers, or both. HTTP servers handle regular HTTP requests, while HTTPS servers handle secure HTTP requests over SSL/TLS.
  33.  
  34. 6. **Types of authorization like stateful and stateless?**
  35.    - Stateful authorization relies on maintaining session state on the server, typically using cookies or server-side storage. Stateless authorization, such as JWT (JSON Web Tokens), does not require server-side state and relies on tokens for authentication.
  36.  
  37. 7. **function Test(){ Return this } What will it return?**
  38.    - It will return the global object (`window` in the browser, `global` in Node.js) because `this` refers to the context in which the function is called, and in a non-strict mode function, it refers to the global object by default.
  39.  
  40. 8. **What is middleware?**
  41.    - Middleware in Express.js are functions that have access to the request, response, and next middleware function in the application's request-response cycle. They can perform tasks such as logging, authentication, data parsing, and error handling.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement