Backend and Nodejs Answers
Backend and Nodejs Answers
js
1. Backend development focuses on server-side logic, databases, and APIs; Frontend focuses on
2. Backend development handles data processing, server logic, and integrations for web
applications.
3. APIs are interfaces allowing software components to interact; used to connect frontend with
backend.
4. RESTful APIs follow REST principles; they use HTTP methods for CRUD operations, unlike
SOAP APIs.
5. HTTP methods: GET (retrieve), POST (create), PUT (update), DELETE (remove).
6. A backend server uses frameworks like Express to handle requests and send responses.
7. Components: server (processes logic), database (stores data), and API (connects components).
8. It processes requests via routing, interacts with databases, and returns HTTP responses.
9. Secure APIs using authentication, rate limiting, CORS, and encryption (HTTPS).
10. User authentication involves verifying identity using tokens, passwords, or OAuth.
12. Node.js is a JavaScript runtime for building scalable backend applications; popular for speed
and simplicity.
13. Node.js uses event-driven architecture, unlike Java or PHP, which are thread-based.
14. Event loop handles asynchronous tasks in Node.js by managing a queue of events.
15. Callbacks handle async tasks, Promises manage chaining, and async/await improves
readability.
16. Use npm to install dependencies (e.g., npm install); manage versions using package.json.
17. package.json defines a Node.js project, listing dependencies, scripts, and metadata.
18. Use the http module to create a basic server (e.g., http.createServer).
19. Basic server structure includes modules, routing, and request handling.
20. Use mongoose for MongoDB interactions with schemas, queries, and validations.
22. Use the fs module for file operations (readFile, writeFile, etc.).
23. async/await simplifies async code by avoiding nested callbacks and improving clarity.
24. Callback hell occurs with nested callbacks; solved by Promises and async/await.
25. Non-blocking I/O enables concurrent handling of multiple tasks, boosting performance.