Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.48 KB

README.md

File metadata and controls

47 lines (33 loc) · 1.48 KB

FastAPI on Cosmoner

Deploy to Cosmoner

A small Python JSON API built with FastAPI, ready to run as a web service on Cosmoner. No database.

Route Returns
GET /health {"status":"ok"}, for health checks
GET /api/hello?name=Ada A greeting
GET /api/items A list of sample items
GET /api/items/{id} One item, or a 404
GET /docs Interactive API documentation

Routes are in main.py. The sample items live in memory, so replace them with your own storage.

Deploy

Select the button above, copy the template to your GitHub account, and deploy your copy. The wizard can fill in every setting from .cosmoner/deployment.yaml: a web service, built automatically from pyproject.toml and uv.lock.

Nothing needs configuring. The Procfile starts Uvicorn on the port in the PORT environment variable, which Cosmoner sets for you, and trusts the platform's proxy headers so redirects keep the https address.

Run locally

Requires Python 3.13 and uv.

uv sync
uv run uvicorn main:app --reload

The API answers on http://localhost:8000, with its documentation at http://localhost:8000/docs.

To add a dependency, run uv add <package>, which updates pyproject.toml and uv.lock together.

License

MIT