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"
|
name = "api"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"atproto",
|
||||||
"axum",
|
"axum",
|
||||||
"http",
|
"http",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
|
|
@ -84,6 +87,10 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atrium-api",
|
"atrium-api",
|
||||||
"lazy-regex",
|
"lazy-regex",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
members = [ "api", "atproto","db", "ingestor"]
|
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::{
|
use crate::router::{
|
||||||
atproto::Nsid,
|
Router,
|
||||||
ingestor::start_ingestor,
|
Endpoint,
|
||||||
router::{
|
xrpc::{
|
||||||
Router,
|
QueryInput,
|
||||||
Endpoint,
|
ProcedureInput,
|
||||||
xrpc::{
|
Response,
|
||||||
QueryInput,
|
error,
|
||||||
ProcedureInput,
|
|
||||||
Response,
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use atproto::Nsid;
|
||||||
use http::status::StatusCode;
|
use http::status::StatusCode;
|
||||||
|
|
||||||
mod atproto;
|
|
||||||
mod ingestor;
|
|
||||||
mod lexicons;
|
|
||||||
mod router;
|
mod router;
|
||||||
// mod db;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn 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");
|
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_query(get_nsid, test));
|
||||||
router = router.add_endpoint(Endpoint::new_xrpc_procedure(post_nsid, test2));
|
router = router.add_endpoint(Endpoint::new_xrpc_procedure(post_nsid, test2));
|
||||||
tokio::spawn(async move {
|
|
||||||
start_ingestor().await;
|
|
||||||
});
|
|
||||||
router.serve().await;
|
router.serve().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
use crate::{
|
use crate::router::xrpc::{
|
||||||
atproto::Nsid,
|
XrpcEndpoint,
|
||||||
router::xrpc::{
|
XrpcHandler,
|
||||||
XrpcEndpoint,
|
QueryInput,
|
||||||
XrpcHandler,
|
ProcedureInput,
|
||||||
QueryInput,
|
|
||||||
ProcedureInput,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
use atproto::Nsid;
|
||||||
use axum::Router as AxumRouter;
|
use axum::Router as AxumRouter;
|
||||||
use core::net::SocketAddr;
|
use core::net::SocketAddr;
|
||||||
use std::net::{IpAddr, Ipv4Addr};
|
use std::net::{IpAddr, Ipv4Addr};
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::atproto::Nsid;
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
future::Future,
|
future::Future,
|
||||||
};
|
};
|
||||||
|
use atproto::Nsid;
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::{
|
extract::{
|
||||||
Json,
|
Json,
|
||||||
|
|
@ -6,3 +6,7 @@ edition = "2024"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
atrium-api = { version = "0.25.3", default-features = false }
|
atrium-api = { version = "0.25.3", default-features = false }
|
||||||
lazy-regex = "3.4.1"
|
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