Feature/add node description api (#605)

* Starting to build out node descriptions

* Renamed the mod to node_description instead of descriptor

* Returning results loaded from file

* Taking user input for node describe command

* Readline without new dependencies

* Adding input format hint

* Making sure the node can still start even when the descriptor file isn't there yet

* Adding some additional runtime checks

* Removing -dev from minimum node version

* Removing initial :: on serde

* Fixing comment on the /description endpoint

* Swapped json for toml

* Being a bit more specific with my startup message.

* Cleaning up path building

* Nicer runtime checks

* Put path building inside the file methods
This commit is contained in:
Dave Hrycyszyn
2021-05-19 09:25:11 -04:00
committed by GitHub
parent ea62d01e65
commit 190d3c4972
10 changed files with 149 additions and 10 deletions
+9
View File
@@ -0,0 +1,9 @@
use crate::node::node_description::NodeDescription;
use rocket::State;
use rocket_contrib::json::Json;
/// Returns a description of the node and why someone might want to delegate stake to it.
#[get("/description")]
pub(crate) fn description(description: State<NodeDescription>) -> Json<NodeDescription> {
Json(description.inner().clone())
}
+3 -2
View File
@@ -1,7 +1,8 @@
use rocket::Request;
pub(crate) mod description;
pub(crate) mod verloc;
use rocket::Request;
#[catch(404)]
pub(crate) fn not_found(req: &Request) -> String {
format!("I couldn't find '{}'. Try something else?", req.uri())