mirror of https://github.com/mastodon/flodgatt
Added all endpoints
This commit is contained in:
parent
7caa714891
commit
1339784112
|
@ -1,5 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ragequit"
|
name = "ragequit"
|
||||||
|
description = "A blazingly fast drop-in replacement for the Mastodon streaming api server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Julian Laubstein <contact@julianlaubstein.de>"]
|
authors = ["Julian Laubstein <contact@julianlaubstein.de>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
max_width = 120
|
|
@ -0,0 +1,5 @@
|
||||||
|
use actix_web::{HttpRequest, Responder};
|
||||||
|
|
||||||
|
pub fn index(_req: HttpRequest) -> impl Responder {
|
||||||
|
"OMG! It works!"
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
use actix_web::{HttpRequest, Responder};
|
||||||
|
|
||||||
|
pub fn index(_req: HttpRequest) -> impl Responder {
|
||||||
|
"OMG! It works!"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn local(_req: HttpRequest) -> impl Responder {
|
||||||
|
"OMG! It works!"
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
use actix_web::{HttpRequest, Responder};
|
||||||
|
|
||||||
|
pub fn index(_req: HttpRequest) -> impl Responder {
|
||||||
|
"OMG! It works!"
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
pub mod direct;
|
||||||
|
pub mod hashtag;
|
||||||
|
pub mod list;
|
||||||
|
pub mod public;
|
||||||
|
pub mod user;
|
|
@ -0,0 +1,9 @@
|
||||||
|
use actix_web::{HttpRequest, Responder};
|
||||||
|
|
||||||
|
pub fn index(_req: HttpRequest) -> impl Responder {
|
||||||
|
"OMG! It works!"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn local(_req: HttpRequest) -> impl Responder {
|
||||||
|
"OMG! It works!"
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
use actix_web::{HttpRequest, Responder};
|
||||||
|
|
||||||
|
pub fn index(_req: HttpRequest) -> impl Responder {
|
||||||
|
"OMG! It works!"
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
pub mod http;
|
||||||
|
pub mod ws;
|
|
@ -0,0 +1,5 @@
|
||||||
|
use actix_web::{HttpRequest, Responder};
|
||||||
|
|
||||||
|
pub fn index(_req: HttpRequest) -> impl Responder {
|
||||||
|
"OMG! WebSocket works!"
|
||||||
|
}
|
28
src/main.rs
28
src/main.rs
|
@ -1,4 +1,6 @@
|
||||||
use actix_web::{server, App, HttpRequest, Responder};
|
mod api;
|
||||||
|
|
||||||
|
use actix_web::{server, App};
|
||||||
use env_logger::Builder;
|
use env_logger::Builder;
|
||||||
use log::info;
|
use log::info;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
@ -19,12 +21,22 @@ fn main() {
|
||||||
|
|
||||||
info!("starting streaming api server");
|
info!("starting streaming api server");
|
||||||
|
|
||||||
server::new(|| App::new().resource("/api/v1/streaming", |r| r.with(index)))
|
let addr: SocketAddr = ([127, 0, 0, 1], args.port).into();
|
||||||
.bind(SocketAddr::from(([127, 0, 0, 1], args.port)))
|
|
||||||
.unwrap()
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn index(_req: HttpRequest) -> impl Responder {
|
use api::{http, ws};
|
||||||
"OMG! It works!"
|
|
||||||
|
server::new(|| {
|
||||||
|
App::new()
|
||||||
|
.resource("/api/v1/streaming/user", |r| r.with(http::user::index))
|
||||||
|
.resource("/api/v1/streaming/public", |r| r.with(http::public::index))
|
||||||
|
.resource("/api/v1/streaming/public/local", |r| r.with(http::public::local))
|
||||||
|
.resource("/api/v1/streaming/direct", |r| r.with(http::direct::index))
|
||||||
|
.resource("/api/v1/streaming/hashtag", |r| r.with(http::hashtag::index))
|
||||||
|
.resource("/api/v1/streaming/hashtag/local", |r| r.with(http::hashtag::local))
|
||||||
|
.resource("/api/v1/streaming/list", |r| r.with(http::list::index))
|
||||||
|
.resource("/api/v1/streaming", |r| r.with(ws::index))
|
||||||
|
})
|
||||||
|
.bind(addr)
|
||||||
|
.unwrap()
|
||||||
|
.run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue