This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Add initial Rest API #23
Merged
agunde406
merged 2 commits into
hyperledger-archives:master
from
shannynalayna:init_rest_api
Mar 27, 2019
Merged
Add initial Rest API #23
agunde406
merged 2 commits into
hyperledger-archives:master
from
shannynalayna:init_rest_api
Mar 27, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shannynalayna
requested review from
agunde406,
boydjohnson,
annechenette,
davececchi,
dcmiddle,
dplumb94,
jsmitchell,
peterschwarz,
rbuysse,
RyanLassigBanks and
vaporos
as code owners
March 26, 2019 16:35
agunde406
suggested changes
Mar 26, 2019
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>
shannynalayna
force-pushed
the
init_rest_api
branch
from
March 26, 2019 18:35
2e971f7
to
103ad1f
Compare
daemon/src/rest_api/mod.rs
Outdated
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(); |
There was a problem hiding this comment.
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.
daemon/src/config.rs
Outdated
@@ -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)) |
There was a problem hiding this comment.
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".
daemon/src/main.rs
Outdated
@@ -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()); |
There was a problem hiding this comment.
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>
shannynalayna
force-pushed
the
init_rest_api
branch
from
March 26, 2019 20:11
1d1a485
to
e3eecd9
Compare
vaporos
approved these changes
Mar 27, 2019
agunde406
approved these changes
Mar 27, 2019
peterschwarz
approved these changes
Mar 27, 2019
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
Disable Travis CI builds
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thedaemon
folder. Then, run the commandcurl http://localhost:8080
in a terminal, or accesshttp://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