Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Q1. What is express?
- Q2. What is event loop?
- Q3. let arr = [1,2,4]
- arr.map(async (val) => {
- Return a*2
- }
- What it will return?
- Q4. What is passcodejs?
- Q5. Types of server in express?
- Q6. Types of authorization like stateful and stateless?
- Q7. function Test(){
- Return this
- }
- What it will return?
- Q8. What is middleware?
- Sure, here are the answers to your questions in short and easy bullet points:
- 1. **What is express?**
- - Express is a minimalist web framework for Node.js used to build web applications and APIs quickly and easily.
- 2. **What is event loop?**
- - 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.
- 3. **let arr = [1,2,4] arr.map(async (val) => { Return a*2 } What it will return?**
- - It will return an array of promises because the callback function inside `map` is declared as `async`, causing each iteration to return a promise.
- 4. **What is passport.js?**
- - 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.
- 5. **Types of servers in express?**
- - 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.
- 6. **Types of authorization like stateful and stateless?**
- - 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.
- 7. **function Test(){ Return this } What will it return?**
- - 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.
- 8. **What is middleware?**
- - 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