Api, setup. Modified atproto to get here
This commit is contained in:
parent
6e97eb1899
commit
556b6b3db6
7 changed files with 49 additions and 28 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
|
@ -51,8 +51,11 @@ dependencies = [
|
|||
name = "api"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"atproto",
|
||||
"axum",
|
||||
"http",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
|
|
@ -84,6 +87,10 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"atrium-api",
|
||||
"lazy-regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
[workspace]
|
||||
resolver = "3"
|
||||
members = [ "api", "atproto","db", "ingestor"]
|
||||
|
||||
[workspace.dependencies]
|
||||
atproto = { path = "./atproto" }
|
||||
serde = "1.0.219"
|
||||
serde_json = "1.0.140"
|
||||
tokio = { version = "1.45.0", features = ["macros", "rt-multi-thread"] }
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = "0.3.19"
|
||||
|
|
|
|||
14
api/Cargo.toml
Normal file
14
api/Cargo.toml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "api"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
atproto.workspace = true
|
||||
axum = { version = "0.8.3", features = ["json"] }
|
||||
http = "1.3.1"
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
tokio.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
tracing.workspace = true
|
||||
|
|
@ -1,24 +1,17 @@
|
|||
use crate::{
|
||||
atproto::Nsid,
|
||||
ingestor::start_ingestor,
|
||||
router::{
|
||||
Router,
|
||||
Endpoint,
|
||||
xrpc::{
|
||||
QueryInput,
|
||||
ProcedureInput,
|
||||
Response,
|
||||
error,
|
||||
},
|
||||
use crate::router::{
|
||||
Router,
|
||||
Endpoint,
|
||||
xrpc::{
|
||||
QueryInput,
|
||||
ProcedureInput,
|
||||
Response,
|
||||
error,
|
||||
},
|
||||
};
|
||||
use atproto::Nsid;
|
||||
use http::status::StatusCode;
|
||||
|
||||
mod atproto;
|
||||
mod ingestor;
|
||||
mod lexicons;
|
||||
mod router;
|
||||
// mod db;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
|
@ -30,9 +23,6 @@ async fn main() {
|
|||
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_ingestor().await;
|
||||
});
|
||||
router.serve().await;
|
||||
}
|
||||
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
use crate::{
|
||||
atproto::Nsid,
|
||||
router::xrpc::{
|
||||
XrpcEndpoint,
|
||||
XrpcHandler,
|
||||
QueryInput,
|
||||
ProcedureInput,
|
||||
}
|
||||
use crate::router::xrpc::{
|
||||
XrpcEndpoint,
|
||||
XrpcHandler,
|
||||
QueryInput,
|
||||
ProcedureInput,
|
||||
};
|
||||
use atproto::Nsid;
|
||||
use axum::Router as AxumRouter;
|
||||
use core::net::SocketAddr;
|
||||
use std::net::{IpAddr, Ipv4Addr};
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
use crate::atproto::Nsid;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
pin::Pin,
|
||||
future::Future,
|
||||
};
|
||||
use atproto::Nsid;
|
||||
use axum::{
|
||||
extract::{
|
||||
Json,
|
||||
|
|
@ -6,3 +6,7 @@ edition = "2024"
|
|||
[dependencies]
|
||||
atrium-api = { version = "0.25.3", default-features = false }
|
||||
lazy-regex = "3.4.1"
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
tracing.workspace = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue