77 lines
1.3 KiB
Markdown
77 lines
1.3 KiB
Markdown
# Cosmo Backend
|
|
|
|
Backend API for the Cosmo deep space explorer visualization system.
|
|
|
|
## Setup
|
|
|
|
1. Create virtual environment:
|
|
```bash
|
|
python -m venv venv
|
|
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
```
|
|
|
|
2. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Copy environment file:
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
## Running
|
|
|
|
Start the development server:
|
|
```bash
|
|
cd backend
|
|
python -m app.main
|
|
```
|
|
|
|
Or using uvicorn directly:
|
|
```bash
|
|
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
|
|
```
|
|
|
|
The API will be available at:
|
|
- API: http://localhost:8000/api
|
|
- Docs: http://localhost:8000/docs
|
|
- Health: http://localhost:8000/health
|
|
|
|
## API Endpoints
|
|
|
|
### Get Celestial Positions
|
|
```
|
|
GET /api/celestial/positions
|
|
```
|
|
|
|
Query parameters:
|
|
- `start_time`: ISO 8601 datetime (optional)
|
|
- `end_time`: ISO 8601 datetime (optional)
|
|
- `step`: Time step, e.g., "1d", "12h" (default: "1d")
|
|
|
|
Example:
|
|
```
|
|
http://localhost:8000/api/celestial/positions?start_time=2025-01-01T00:00:00Z&end_time=2025-01-10T00:00:00Z&step=1d
|
|
```
|
|
|
|
### Get Body Info
|
|
```
|
|
GET /api/celestial/info/{body_id}
|
|
```
|
|
|
|
Example:
|
|
```
|
|
http://localhost:8000/api/celestial/info/-31
|
|
```
|
|
|
|
### List All Bodies
|
|
```
|
|
GET /api/celestial/list
|
|
```
|
|
|
|
### Clear Cache
|
|
```
|
|
POST /api/celestial/cache/clear
|
|
```
|