42 lines
787 B
Markdown
42 lines
787 B
Markdown
# Cyber Hybrid Hub API
|
|
|
|
Postgres-backed profile API for the Flutter app.
|
|
|
|
## Setup
|
|
|
|
1. Create the database (once):
|
|
|
|
```bash
|
|
createdb cyberhybridhub
|
|
```
|
|
|
|
2. Copy and edit environment variables:
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
3. Install dependencies and run (from this `server/` directory):
|
|
|
|
```bash
|
|
dart pub get
|
|
dart run bin/server.dart
|
|
```
|
|
|
|
The API listens on `http://localhost:3000` by default (`PORT` in `.env`).
|
|
|
|
## Endpoints
|
|
|
|
| Method | Path | Auth |
|
|
|--------|------|------|
|
|
| `GET` | `/v1/me/profile` | `Authorization: Bearer <Firebase ID token>` |
|
|
| `PUT` | `/v1/me/profile` | same |
|
|
|
|
## Flutter client
|
|
|
|
Run the app with the API URL (defaults to `http://localhost:3000`):
|
|
|
|
```bash
|
|
flutter run --dart-define=API_BASE_URL=http://localhost:3000
|
|
```
|