Create a simple test_registry binary which just dumps out JSON at the moment
This gives Contaminate something to talk to, at least while I'm on the plane ^_^
This commit is contained in:
parent
688e0cbe86
commit
df8c932a0c
|
@ -4,6 +4,10 @@ version = "0.1.0"
|
|||
authors = ["R. Tyler Croy <rtyler@brokenco.de>"]
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
name = "test-registry"
|
||||
path = "src/test_registry/main.rs"
|
||||
|
||||
[dependencies]
|
||||
# Used for serving the website
|
||||
tide = "~0.5.1"
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* The test_registry is a simple service which just responds with some canned
|
||||
* JSON responses
|
||||
*/
|
||||
|
||||
extern crate pretty_env_logger;
|
||||
extern crate tide;
|
||||
|
||||
use async_std::task;
|
||||
use log::*;
|
||||
use tide::Request;
|
||||
|
||||
|
||||
async fn generic_json(req: Request<()>) -> String {
|
||||
info!("Received request to: {}", req.uri());
|
||||
format!(r#"{{"url" : "{}"}}"#, req.uri())
|
||||
}
|
||||
|
||||
fn main() -> Result<(), std::io::Error> {
|
||||
pretty_env_logger::init();
|
||||
|
||||
task::block_on(async {
|
||||
let mut app = tide::new();
|
||||
app.at("/").get(generic_json);
|
||||
app.at("*").get(generic_json);
|
||||
app.listen("127.0.0.1:2345").await?;
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
}
|
Loading…
Reference in New Issue