Health Check
The health check endpoint allows you to verify that the API server is running and responding to requests.
Endpoint
Description
This endpoint is used for monitoring and load balancer health checks. It returns a simple status response indicating that the server is operational.
Request
HEAD Request
The HEAD method returns only the HTTP status code without a response body, making it ideal for health checks.
Request Example:
Response:
GET Request
The GET method returns a JSON response with the status.
Request Example:
Response
Success Response (200 OK)
Status Code: 200 OK
Response Body (GET only):
Response Headers:
Authentication
This endpoint does not require authentication.
Use Cases
- Load Balancer Health Checks: Configure your load balancer to check this endpoint
- Monitoring Systems: Use this endpoint to monitor API availability
- CI/CD Pipelines: Verify API is running after deployments
- Service Discovery: Check if the service is ready to accept requests
Example Usage
Using curl (HEAD)
Using curl (GET)
Using JavaScript (Fetch API)
// HEAD request
fetch('https://api.luxmart.site/health-check', {
method: 'HEAD'
})
.then(response => {
if (response.ok) {
console.log('API is healthy');
}
});
// GET request
fetch('https://api.luxmart.site/health-check')
.then(response => response.json())
.then(data => {
console.log('Status:', data.status);
});
Notes
- The endpoint responds quickly without performing any database queries or heavy operations
- Both HEAD and GET methods return the same status code (200 OK)
- The endpoint is always available, even if other API endpoints are experiencing issues
- No rate limiting is applied to this endpoint