mirror of https://github.com/mastodon/flodgatt
Initial project files
This commit is contained in:
parent
cb0d9a5517
commit
7caa714891
|
@ -0,0 +1,2 @@
|
|||
/target
|
||||
**/*.rs.bk
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "ragequit"
|
||||
version = "0.1.0"
|
||||
authors = ["Julian Laubstein <contact@julianlaubstein.de>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "0.7.18"
|
||||
structopt = "0.2.14"
|
||||
log = "0.4.6"
|
||||
env_logger = "0.6.0"
|
|
@ -0,0 +1,7 @@
|
|||
# RageQuit
|
||||
A blazingly fast drop-in replacement for the Mastodon streaming api server
|
||||
|
||||
## Usage
|
||||
```shell
|
||||
$ ragequit --port 4002 # Default port is 3666
|
||||
```
|
|
@ -0,0 +1,30 @@
|
|||
use actix_web::{server, App, HttpRequest, Responder};
|
||||
use env_logger::Builder;
|
||||
use log::info;
|
||||
use std::net::SocketAddr;
|
||||
use structopt::StructOpt;
|
||||
|
||||
const ENV_LOG_VARIABLE: &str = "STREAMING_API_LOG";
|
||||
|
||||
#[derive(StructOpt)]
|
||||
struct Opt {
|
||||
#[structopt(short, long, default_value = "3666")]
|
||||
port: u16,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Builder::from_env(ENV_LOG_VARIABLE).init();
|
||||
|
||||
let args = Opt::from_args();
|
||||
|
||||
info!("starting streaming api server");
|
||||
|
||||
server::new(|| App::new().resource("/api/v1/streaming", |r| r.with(index)))
|
||||
.bind(SocketAddr::from(([127, 0, 0, 1], args.port)))
|
||||
.unwrap()
|
||||
.run();
|
||||
}
|
||||
|
||||
fn index(_req: HttpRequest) -> impl Responder {
|
||||
"OMG! It works!"
|
||||
}
|
Loading…
Reference in New Issue