๐ง 166. What is an API?
API stands for: ๐ Application Programming Interface
An API allows different software applications to communicate with each other.
Example:
When a weather app fetches weather data from a server, it uses an API.
Benefits:
โ Data sharing
โ System integration
โ Automation
๐ง 167. Difference Between REST and GraphQL
Concept | REST | GraphQL
Endpoints | Multiple endpoints | Single endpoint
Response structure | Fixed response structure | Client chooses data
Data fetching | Over-fetching possible | Fetch only needed data
Complexity | Simpler | More flexible
Example:
REST: GET /users/1
GraphQL:
{
user(id:1){
name
email
}
}๐ง 168. What is a RESTful API?
RESTful API follows REST architectural principles.
Key Principles:
Stateless
Client-Server Architecture
Uniform Interface
Resource-Based URLs
Example:
GET /users
POST /users
PUT /users/1
DELETE /users/1
๐ง 169. What are HTTP Status Codes?
HTTP status codes indicate server response status.
Categories:
Range | Meaning
1xx | Informational
2xx | Success
3xx | Redirection
4xx | Client Error
5xx | Server Error
๐ง 170. Explain 200, 201, 400, 401, 403, 404, and 500
Code | Meaning
200 | OK
201 | Created
400 | Bad Request
401 | Unauthorized
403 | Forbidden
404 | Not Found
500 | Internal Server Error
Example:
res.status(404).json({
message: "User Not Found"
});๐ง 171. What is API Testing?
API Testing verifies functionality, performance, and security of APIs.
Checks:
โ Response data
โ Status codes
โ Authentication
โ Performance
Tools:
Postman
Insomnia
Swagger
๐ง 172. What is Postman?
Postman is a tool used to test APIs.
Features:
โ Send API requests
โ Test endpoints
โ Automate testing
โ Manage collections
Example:
GET https://api.example.com/users
๐ง 173. What is WebSocket?
WebSocket enables real-time two-way communication between client and server.
Uses:
Chat applications
Online gaming
Live notifications
Stock market updates
Benefits:
โ Real-time communication
โ Low latency
๐ง 174. Difference Between Polling and WebSocket
Concept | Polling | WebSocket
Connection | Client repeatedly asks server | Persistent connection
Network usage | Higher network usage | Efficient communication
Updates | Slower updates | Real-time updates
๐ง 175. What is Microservice Architecture?
Microservices divide an application into small independent services.
Example:
User Service
Payment Service
Order Service
Notification Service
Benefits:
โ Scalability
โ Independent deployment
โ Easier maintenance
๐ง 176. What is Monolithic Architecture?
Monolithic architecture combines all components into one application.
Example:
Frontend
Backend
Database
โ
Single Application
Advantages:
โ Simpler development initially
Disadvantages:
โ Harder to scale
๐ง 177. What is Caching?
Caching stores frequently accessed data temporarily for faster retrieval.
Benefits:
โ Faster performance
โ Reduced database load
โ Improved user experience
Example:
cache.set("users", data);๐ง 178. What is Redis?
Redis is an in-memory database commonly used for caching.
Features:
โ Extremely fast
โ Key-value storage
โ Session management
Example:
redis.set("user", userData);