Skip to main content

Base URL

The API runs on port 3000 by default:
http://localhost:3000
You can configure the port using the PORT environment variable.

Authentication

Currently, the API does not require authentication. All endpoints are publicly accessible.
For production deployments, consider implementing authentication and authorization mechanisms.

CORS Configuration

The API is configured with CORS enabled:
  • Origin: * (all origins allowed - suitable for development)
  • Methods: GET, POST, PUT, DELETE
  • Allowed Headers: Content-Type, Authorization
In production, restrict the origin to specific domains instead of allowing all origins.

Available Endpoints

Root Endpoint

GET / - Returns a welcome message

File Upload

POST /users/upload - Upload a file to the server

Static File Serving

GET /uploads/:filename - Access uploaded files directly

Common Response Formats

Success Response

Successful requests return JSON with appropriate data:
{
  "message": "Success message",
  "data": {}
}

Error Response

Error responses follow this structure:
{
  "message": "Error description"
}
message
string
required
Description of the error or success status

Content Types

The API supports the following content types:
  • application/json - For JSON request/response bodies
  • multipart/form-data - For file uploads

Rate Limiting

Currently, no rate limiting is implemented. Consider adding rate limiting middleware for production deployments.

HTTP Status Codes

The API uses standard HTTP status codes:
Status CodeDescription
200Success - Request completed successfully
400Bad Request - Invalid or missing parameters
404Not Found - Resource not found
500Internal Server Error - Server-side error

Next Steps

File Upload

Learn how to upload files to the server

Examples

View code examples in multiple languages

Build docs developers (and LLMs) love