mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-21 13:15:50 +00:00
Start to stub out sub-services
This commit is contained in:
@@ -7,6 +7,11 @@ use std::{
|
||||
sync::{mpsc, Arc},
|
||||
};
|
||||
|
||||
use futures::{future, Future};
|
||||
use hyper::{
|
||||
service::Service,
|
||||
Body,
|
||||
};
|
||||
use serde_derive::{Serialize, Deserialize};
|
||||
use rouille::{
|
||||
self,
|
||||
@@ -83,6 +88,17 @@ pub struct ApiServer {
|
||||
server_version: &'static str,
|
||||
}
|
||||
|
||||
impl Service for ApiServer {
|
||||
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 API!"))))
|
||||
}
|
||||
}
|
||||
|
||||
impl ApiServer {
|
||||
pub fn new(live_session: Arc<LiveSession>) -> ApiServer {
|
||||
ApiServer {
|
||||
|
||||
Reference in New Issue
Block a user