mirror of
https://github.com/bspeice/nutone
synced 2024-11-23 15:58:09 -05:00
And remove said unimportant files
This commit is contained in:
parent
474995194b
commit
b267877ae0
@ -1,20 +0,0 @@
|
|||||||
extern crate hyper;
|
|
||||||
extern crate rss;
|
|
||||||
|
|
||||||
use rss::Channel;
|
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use broadcast::Broadcaster;
|
|
||||||
|
|
||||||
pub struct BassDrive {
|
|
||||||
pub url: String
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BassDrive {
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Broadcaster for BassDrive {
|
|
||||||
fn broadcast(&self) -> Channel {
|
|
||||||
Channel::from_str("").unwrap()
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
extern crate rss;
|
|
||||||
extern crate hyper;
|
|
||||||
|
|
||||||
use hyper::server::{Request, Response};
|
|
||||||
use rss::Channel;
|
|
||||||
|
|
||||||
pub trait Broadcaster {
|
|
||||||
fn broadcast(&self) -> Channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(unused)]
|
|
||||||
pub fn build_broadcast<T: Broadcaster>(b: T) -> Box<Fn(Request, Response)> {
|
|
||||||
let channel = b.broadcast();
|
|
||||||
|
|
||||||
Box::new(move |_: Request, res: Response| {
|
|
||||||
res.send(channel.to_string().as_bytes());
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
extern crate hyper;
|
|
||||||
extern crate reroute;
|
|
||||||
extern crate rss;
|
|
||||||
|
|
||||||
use hyper::server::{Server, Request, Response, Handler};
|
|
||||||
use reroute::{Router, Captures};
|
|
||||||
|
|
||||||
mod broadcast;
|
|
||||||
mod bassdrive;
|
|
||||||
|
|
||||||
#[allow(unused)]
|
|
||||||
fn http_404(req: Request, res: Response) {
|
|
||||||
res.send(format!("Couldn't find URL: {}", req.uri).as_bytes());
|
|
||||||
}
|
|
||||||
|
|
||||||
struct EchoHandler {
|
|
||||||
response: String
|
|
||||||
}
|
|
||||||
|
|
||||||
impl EchoHandler {
|
|
||||||
fn handle(&self, _: Request, res: Response, _: Captures) {
|
|
||||||
res.send(self.response.as_bytes());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#[allow(unused)]
|
|
||||||
fn main() {
|
|
||||||
let mut router = Router::new();
|
|
||||||
|
|
||||||
let echo = EchoHandler {
|
|
||||||
response: "Hello, world!".to_string()
|
|
||||||
};
|
|
||||||
router.get(r"/hello", echo);
|
|
||||||
|
|
||||||
/*
|
|
||||||
router.get(r"/hello", build_broadcast(
|
|
||||||
BassDrive {
|
|
||||||
url: "http://archives.bassdrivearchive.com/6%20-%20Saturday/Electronic%20Warfare%20-%20The%20Overfiend/"
|
|
||||||
})
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
router.add_not_found(http_404);
|
|
||||||
router.finalize().unwrap();
|
|
||||||
|
|
||||||
Server::http("0.0.0.0:3000").unwrap().handle(router).unwrap();
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user