Python Interview Questions
Practice with real Python interview questions
01
A Backend Developer was asked
Asked in 2024
Q. How do you create a REST API using Node.js? Provide a simple example with GET and POST methods.
Ans. Creating a REST API in Node.js typically involves using the Express framework, which simplifies routing and middleware management. Below is an example of a simple REST API that handles GET and POST requests:
1. First, ensure you have Node.js and Express installed:
**2. Create a file named
app.js with the following code:**
In this example, we have two endpoints: one for retrieving items and another for adding new items. The body-parser middleware is used to parse JSON payloads. When a new item is posted, it is added to the items array, and the newly created item is returned with a status of 201. This shows how to set up a basic RESTful API using Node.js.Backend DeveloperCore Concept
02
A Software Engineering Intern was asked
Asked in 2025
Q. What is a RESTful API?
Ans. 'REST stands for Representational State Transfer. A RESTful API is an architectural style for designing networked applications. It relies on stateless, client-server communication and uses standard HTTP methods like GET, POST, PUT, and DELETE to interact with resources identified by URIs.'
Tip: Mention statelessness and standard HTTP methods.
Software Engineering InternCore Concept
