Src, move out of ./rust, add missing wip files

Moves file contents out of ./rust since I'm planning to go with rust for
the backend and the lexicons will be used for codegen soon anyways.

I also added extra files that have been in the works that I have been
accidentally sprinkling into main.rs already. God forbid I need to
cherry-pick anything from so far back in the history.

It will make git blame ugly though.
This commit is contained in:
Julia Lange 2025-05-06 13:50:57 -07:00
parent 8363125108
commit 49e7340c19
Signed by: Julia
SSH key fingerprint: SHA256:5DJcfxa5/fKCYn57dcabJa2vN2e6eT0pBerYi5SUbto
11 changed files with 846 additions and 21 deletions

41
src/main.rs Normal file
View file

@ -0,0 +1,41 @@
use crate::{
atproto::Nsid,
injester::start_injester,
router::{
Router,
Endpoint,
xrpc::{
QueryInput,
ProcedureInput,
Response,
error,
},
},
};
use http::status::StatusCode;
mod atproto;
mod injester;
mod router;
mod db;
#[tokio::main]
async fn main() {
let mut router = Router::new();
let get_nsid = Nsid::new(String::from("me.woach.get")).expect("me.woach.get is a valid nsid");
let post_nsid = Nsid::new(String::from("me.woach.post")).expect("me.woach.post is a valid nsid");
router = router.add_endpoint(Endpoint::new_xrpc_query(get_nsid, test));
router = router.add_endpoint(Endpoint::new_xrpc_procedure(post_nsid, test2));
tokio::spawn(async move {
start_injester();
});
router.serve().await;
}
async fn test(_data: QueryInput) -> Response {
error(StatusCode::OK, "error", "message")
}
async fn test2(_data: ProcedureInput) -> Response {
error(StatusCode::OK, "error", "message")
}