|
| 1 | +# ht_api (Headlines Toolkit API) |
| 2 | + |
| 3 | + |
| 4 | +[](https://pub.dev/packages/very_good_analysis) |
| 5 | +[](https://polyformproject.org/licenses/free-trial/1.0.0) |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +`ht_api` is the backend API component of the **Headlines Toolkit (HT)** project. Built with Dart Frog, it serves data and functionality to the corresponding HT Flutter mobile application and Flutter web dashboard. Currently, its primary focus is managing country-related data via the `ht_countries_client` package. |
| 10 | + |
| 11 | +## Features |
| 12 | + |
| 13 | +### Current |
| 14 | + |
| 15 | +* **🏠 API v1 Root:** Provides a base endpoint for API version 1 (`GET /api/v1/`). |
| 16 | + |
| 17 | +* **🌍 Country Endpoints (`/api/v1/countries`)** |
| 18 | + * 📜 **List All:** Retrieve a list of all available countries (`GET`). |
| 19 | + * 🔍 **Get by ISO Code:** Retrieve details for a specific country (`GET /{isoCode}`). |
| 20 | + * ➕ **Create:** Add a new country (`POST`). |
| 21 | + * 🔄 **Update:** Modify an existing country (`PUT` or `PATCH /{isoCode}`). |
| 22 | + * 🗑️ **Delete:** Remove a country (`DELETE /{isoCode}`). |
| 23 | + |
| 24 | +### Planned |
| 25 | + |
| 26 | +* (No specific planned features identified yet - can be updated as needed) |
| 27 | + |
| 28 | +## Technical Overview |
| 29 | + |
| 30 | +* **Language:** Dart |
| 31 | +* **Framework:** Dart Frog |
| 32 | +* **Architecture:** Follows standard Dart Frog structure with route-based handlers and middleware. Uses dependency injection to provide the `HtCountriesClient`. Part of the larger Headlines Toolkit ecosystem. |
| 33 | +* **Key Libraries/Packages:** |
| 34 | + * `dart_frog`: Core backend framework. |
| 35 | + * `ht_countries_client`: Shared package used as the data source for country information. |
| 36 | + * `very_good_analysis`: Linting rules. |
| 37 | +* **Error Handling:** Centralized error handling middleware is implemented. |
| 38 | + |
| 39 | +## Setup & Running |
| 40 | + |
| 41 | +1. **Clone the repository:** |
| 42 | + ```bash |
| 43 | + git clone <your-repository-url> |
| 44 | + cd ht_api |
| 45 | + ``` |
| 46 | +2. **Get dependencies:** |
| 47 | + ```bash |
| 48 | + dart pub get |
| 49 | + ``` |
| 50 | +3. **Run the development server:** |
| 51 | + ```bash |
| 52 | + dart_frog dev |
| 53 | + ``` |
| 54 | + The API will typically be available at `http://localhost:8080`. |
| 55 | + |
| 56 | +## License |
| 57 | + |
| 58 | +This package is licensed under the [PolyForm Free Trial](LICENSE). Please review the terms before use. |
0 commit comments