mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
* Aiming for #286 - quick placeholder to have at least something to help your memory * corrections:pool/push get->post, add sumtrees/(roots|lastutxos|lastrangeproofs|lastkernels)
This commit is contained in:
parent
08a277f8d1
commit
7986829d58
1 changed files with 30 additions and 0 deletions
|
@ -35,6 +35,21 @@ use util;
|
|||
use util::LOGGER;
|
||||
|
||||
|
||||
// RESTful index of available api endpoints
|
||||
// GET /v1/
|
||||
struct IndexHandler {
|
||||
list: Vec<String>,
|
||||
}
|
||||
|
||||
impl IndexHandler {
|
||||
}
|
||||
|
||||
impl Handler for IndexHandler {
|
||||
fn handle(&self, _req: &mut Request) -> IronResult<Response> {
|
||||
json_response_pretty(&self.list)
|
||||
}
|
||||
}
|
||||
|
||||
// Supports retrieval of multiple outputs in a single request -
|
||||
// GET /v1/chain/utxos?id=xxx,yyy,zzz
|
||||
// GET /v1/chain/utxos?id=xxx&id=yyy&id=zzz
|
||||
|
@ -317,7 +332,22 @@ pub fn start_rest_apis<T>(
|
|||
p2p_server: p2p_server.clone(),
|
||||
};
|
||||
|
||||
let route_list = vec!(
|
||||
"get /".to_string(),
|
||||
"get /chain".to_string(),
|
||||
"get /chain/utxos".to_string(),
|
||||
"get /sumtrees/roots".to_string(),
|
||||
"get /sumtrees/lastutxos?n=10".to_string(),
|
||||
"get /sumtrees/lastrangeproofs".to_string(),
|
||||
"get /sumtrees/lastkernels".to_string(),
|
||||
"get /pool".to_string(),
|
||||
"post /pool/push".to_string(),
|
||||
"get /peers/all".to_string(),
|
||||
"get /peers/connected".to_string(),
|
||||
);
|
||||
let index_handler = IndexHandler { list: route_list };
|
||||
let router = router!(
|
||||
index: get "/" => index_handler,
|
||||
chain_tip: get "/chain" => chain_tip_handler,
|
||||
chain_utxos: get "/chain/utxos" => utxo_handler,
|
||||
sumtree_roots: get "/sumtrees/*" => sumtree_handler,
|
||||
|
|
Loading…
Reference in a new issue