Express.js Interviewfragen und Antworten
Frage 21. Explain the purpose of the 'multer' middleware in Express.js.
'multer' is a middleware used for handling 'multipart/form-data,' primarily used for file uploads. It adds a 'body' object and a 'file' or 'files' object to the 'request' object.
Frage 22. How can you implement authentication in Express.js?
Authentication in Express.js can be implemented using middleware like 'passport' along with relevant strategies (e.g., local strategy, OAuth).
Frage 23. Explain the purpose of the 'express-validator' library in Express.js.
'express-validator' is a set of Express.js middlewares that wraps validator.js validator and sanitizer functions, providing validation and sanitation of user input.
Frage 24. How can you implement rate limiting in Express.js?
Rate limiting in Express.js can be implemented using middleware such as 'express-rate-limit' to restrict the number of requests from a client in a given time frame.
Frage 25. What is the purpose of the 'compression' middleware in Express.js?
'compression' is a middleware that compresses the response body for requests that traverse through it, reducing the size of the response and improving performance.
Am hilfreichsten laut Nutzern:
- How to handle errors in Express.js?
- What is Express.js?
- How to install Express.js?
- What is middleware in Express.js?
- What is the purpose of app.use() in Express.js?