Atproto, Router, add atproto api mod with Nsid
Sets up a generic atproto module to store atproto implementation. Mainly doing this so that I can switch between rsky/atrium as well as add my own layers on top. This also switches the old Xrpc/Router use of Nsid to the atproto api implementation of it. Next up is the DB where I'll need a bunch of these.
This commit is contained in:
parent
d4a3a71e2f
commit
db33099405
6 changed files with 858 additions and 32 deletions
|
|
@ -1,4 +1,6 @@
|
|||
use crate::router::{
|
||||
use crate::{
|
||||
atproto::Nsid,
|
||||
router::{
|
||||
Router,
|
||||
Endpoint,
|
||||
xrpc::{
|
||||
|
|
@ -7,18 +9,21 @@ use crate::router::{
|
|||
Response,
|
||||
error,
|
||||
},
|
||||
},
|
||||
};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use http::status::StatusCode;
|
||||
|
||||
mod atproto;
|
||||
mod router;
|
||||
mod db;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let mut router = Router::new();
|
||||
router = router.add_endpoint(Endpoint::new_xrpc_query(String::from("me.woach.get"), test));
|
||||
router = router.add_endpoint(Endpoint::new_xrpc_procedure(String::from("me.woach.post"), test2));
|
||||
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));
|
||||
router.serve().await;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue