Skip to content

Instantly share code, notes, and snippets.

@jb55
Created September 1, 2018 18:10
Show Gist options
  • Save jb55/1f3bd007b0b69047833e4b287c7d740e to your computer and use it in GitHub Desktop.
Save jb55/1f3bd007b0b69047833e4b287c7d740e to your computer and use it in GitHub Desktop.
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