Split into libraries - further cleanup
This commit is contained in:
parent
3b70d26155
commit
966ad6809b
@ -1,28 +0,0 @@
|
|||||||
use axum::{routing::get, Json, Router};
|
|
||||||
#[allow(unused)]
|
|
||||||
use log::{info, debug, warn, error, trace};
|
|
||||||
use tracing::instrument;
|
|
||||||
|
|
||||||
use super::response::SigmaInformation;
|
|
||||||
|
|
||||||
const NAME: &str = "TinyIdentity";
|
|
||||||
const VERSION: &str = "0.0.0.1";
|
|
||||||
|
|
||||||
pub fn router() -> Router {
|
|
||||||
info!("Loading {NAME} app routes");
|
|
||||||
debug!("{NAME} version is {VERSION}");
|
|
||||||
Router::new()
|
|
||||||
.route("/", get(information))
|
|
||||||
.route("/setup", get(dummy))
|
|
||||||
.route("/me", get(dummy))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[instrument]
|
|
||||||
async fn dummy() -> Json<()> {
|
|
||||||
Json(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[instrument]
|
|
||||||
async fn information() -> Json<SigmaInformation> {
|
|
||||||
Json(SigmaInformation::new(NAME, VERSION))
|
|
||||||
}
|
|
||||||
@ -1,8 +1,5 @@
|
|||||||
mod response;
|
|
||||||
mod identity;
|
|
||||||
|
|
||||||
use axum::{routing::get, Json, Router};
|
use axum::{routing::get, Json, Router};
|
||||||
use response::SigmaInformation;
|
use sigma::repsonse::SigmaInformation;
|
||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
use serde::Serialize;
|
|
||||||
|
|
||||||
#[derive(Serialize)]
|
|
||||||
pub struct SigmaInformation {
|
|
||||||
name: String,
|
|
||||||
version: String,
|
|
||||||
}
|
|
||||||
impl SigmaInformation {
|
|
||||||
pub fn new(name: &str, version: &str) -> Self {
|
|
||||||
Self {
|
|
||||||
version: version.into(),
|
|
||||||
name: name.into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
pub enum Error {
|
pub enum Error {
|
||||||
TcpBindFailed = 1,
|
TcpBindFailed = 1,
|
||||||
AxumAppExited = 2,
|
AxumAppExited,
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user