# Request और Reply ऑब्जेक्ट — Fastify

Source: https://www.geekswithgeeks.com/hi/fastify/ff-request-reply

> HTTP संचार को संभालने वाले मूल objects को समझें।

## request और reply

`request` आने वाली HTTP request विवरण रखता है (URL, headers, body, params, query)। `reply` response भेजने के लिए methods वाला object है—performance के लिए pooled है।

## Request डेटा पढ़ना

Request object से path params, query strings, headers, और body access करें।

```javascript
fastify.get('/users/:id', async (request, reply) => {
  const { id } = request.params;
  const { filter } = request.query;
  const token = request.headers.authorization;
  
  return { userId: id, filter, hasToken: !!token };
});
```

## Replies भेजना

Object return करें (auto-serialized to JSON) या custom status codes और headers के लिए `reply` methods उपयोग करें।

```javascript
fastify.post('/items', async (request, reply) => {
  // Auto-JSON serialization
  return { id: 1, status: 'created' };
});

fastify.delete('/items/:id', async (request, reply) => {
  // Custom status and location header
  return reply.status(204).send();
});
```
