Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Add initial Rest API #23

Merged
merged 2 commits into from
Mar 27, 2019

Conversation

shannynalayna
Copy link
Contributor

@shannynalayna shannynalayna commented Mar 26, 2019

Adds initial setup for Rest API which adds a basic Hello World
route and begins a server using Actix.

There is currently a test in place which uses a TestServer to access the index route currently in place. However, you can also test this initial route directly by running cargo run from the daemon folder. Then, run the command curl http://localhost:8080 in a terminal, or access http://localhost:8080 from a web browser and you should see the message "Hello world!" in the response. Use Ctrl+C to shut down this process.

Signed-off-by: Shannyn Telander telander@bitwise.io

daemon/src/rest_api/mod.rs Outdated Show resolved Hide resolved
Adds initial setup for Rest API which adds a basic Hello World
route and begins a server using Actix.

Signed-off-by: Shannyn Telander <telander@bitwise.io>
pub fn run() -> Result<i32, RestApiError> {
let sys = actix::System::new("Grid-Rest-API");

server::new(create_app).bind("127.0.0.1:8080")?.start();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bind string should be a configuration setting.

@@ -86,20 +101,29 @@ mod test {
fn build_with_args() {
let matches = clap::App::new("testapp")
.arg(clap::Arg::with_name("connect").short("C").takes_value(true))
.get_matches_from(vec!["testapp", "-C", "validator:4004"]);
.arg(clap::Arg::with_name("url").short("u").takes_value(true))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be "bind", with the short name "B".

@@ -51,7 +52,8 @@ fn run() -> Result<(), DaemonError> {

info!("Connecting to validator at {}", config.validator_endpoint());

let _ = rest_api::run()?;
let _ = rest_api::run(config.rest_api_endpoint())?;
info!("Connecting to Rest API at {}", config.rest_api_endpoint());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "Starting Rest API at..."

Adds an arg to GridConfig for the rest API url, used to receive
requests for the rest API server.

Signed-off-by: Shannyn Telander <telander@bitwise.io>
@agunde406 agunde406 merged commit 88e387a into hyperledger-archives:master Mar 27, 2019
@shannynalayna shannynalayna deleted the init_rest_api branch February 28, 2022 19:28
ameliabradley pushed a commit to ameliabradley/grid that referenced this pull request Jul 26, 2022
…its-api-request

Use real data in circuits sapling
ameliabradley pushed a commit to ameliabradley/grid that referenced this pull request Jul 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants