Created
September 1, 2018 18:10
-
-
Save jb55/1f3bd007b0b69047833e4b287c7d740e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate actix_web; | |
extern crate serde; | |
extern crate futures; | |
#[macro_use] | |
extern crate serde_derive; | |
mod activitypub; | |
use activitypub::{ Object }; | |
use actix_web::{ | |
http, server, Json, App, HttpResponse, Responder | |
}; | |
fn inbox(activity: Json<Object>) -> impl Responder { | |
println!("{:?}", activity.0); | |
HttpResponse::Ok() | |
} | |
fn main() { | |
server::new( | |
|| App::new() | |
.resource("/inbox", |r| { | |
r.method(http::Method::POST) | |
.with(inbox); | |
})) | |
.bind("0.0.0.0:1150").unwrap() | |
.run() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment