Start to stub out sub-services

This commit is contained in:
Lucien Greathouse
2019-02-22 13:08:07 -08:00
parent 6ea1211bc5
commit 105d8aeb6b
4 changed files with 62 additions and 14 deletions

View File

@@ -2,6 +2,11 @@
use std::sync::Arc;
use futures::{future, Future};
use hyper::{
service::Service,
Body,
};
use rouille::{
self,
router,
@@ -22,6 +27,17 @@ pub struct InterfaceServer {
server_version: &'static str,
}
impl Service for InterfaceServer {
type ReqBody = Body;
type ResBody = Body;
type Error = hyper::Error;
type Future = Box<Future<Item = hyper::Response<Self::ReqBody>, Error = Self::Error> + Send>;
fn call(&mut self, request: hyper::Request<Self::ReqBody>) -> Self::Future {
Box::new(future::ok(hyper::Response::new(Body::from("Hello, from interface!"))))
}
}
impl InterfaceServer {
pub fn new(live_session: Arc<LiveSession>) -> InterfaceServer {
InterfaceServer {