flagrant-api 0.0.2

CLI powered feature-flagging
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use axum::{
    extract::{Path, State},
    Json,
};
use flagrant::models::project;
use flagrant_types::Project;
use sqlx::SqlitePool;

use crate::errors::ServiceError;

pub async fn fetch(
    State(pool): State<SqlitePool>,
    Path(project_id): Path<u16>,
) -> Result<Json<Project>, ServiceError> {
    let project = project::fetch(&pool, project_id).await?;
    Ok(Json(project))
}