openapi-datetime/README.md
2025-09-22 16:07:42 +02:00

47 lines
889 B
Markdown

# FastAPI DateTime Service
This is a simple FastAPI application that provides an OpenAPI-compatible `/datetime` endpoint returning the current date, time, weekday, and calendar week.
## Requirements
- Python 3.7+
- FastAPI
- Uvicorn
```bash
pip install -r requirements.txt
```
## Running the Application
To start the FastAPI server, run:
```bash
python main.py
```
The server will be available at `http://localhost:8000`.
## Endpoints
### `GET /datetime`
Returns current date, time, weekday, and calendar week.
**Response Format:**
```json
{
"date": "2025-09-22",
"time": "14:30:45",
"weekday": "Monday",
"calendar_week": 38
}
```
**Response Fields:**
- `date` (string): Current date in YYYY-MM-DD format
- `time` (string): Current time in HH:MM:SS format
- `weekday` (string): Full weekday name (e.g., "Monday")
- `calendar_week` (integer): ISO calendar week number