-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a stub relational data service while I explore GraphQL
See #63
- Loading branch information
Showing
6 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "reldata" | ||
version = "0.1.0" | ||
authors = ["R. Tyler Croy <[email protected]>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
async-std = { version = "~1.7", features = ["attributes"]} | ||
log = "~0.4.11" | ||
otto-models = { path = "../../crates/models" } | ||
pretty_env_logger = "~0.4.0" | ||
tide = "~0.15.0" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
= Relational Data | ||
|
||
The relational data service provides a centralized location for project, | ||
pipeline, and more data to be stored. This is in contrast to the object store | ||
which is expected to store large files/objects. | ||
|
||
|
||
.Environnment Variables | ||
|=== | ||
| Name | Default | Description | ||
|
||
|=== |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* The relational data service largely is meant to expose information from an underlying database | ||
*/ | ||
use tide::Request; | ||
|
||
async fn healthcheck(_req: Request<()>) -> tide::Result { | ||
Ok(tide::Response::builder(200) | ||
.body("{}") | ||
.content_type("application/json") | ||
.build()) | ||
} | ||
|
||
#[async_std::main] | ||
async fn main() -> std::io::Result<()> { | ||
use std::{env, net::TcpListener, os::unix::io::FromRawFd}; | ||
pretty_env_logger::init(); | ||
|
||
let mut app = tide::new(); | ||
app.at("/health").get(healthcheck); | ||
|
||
if let Some(fd) = env::var("LISTEN_FD").ok().and_then(|fd| fd.parse().ok()) { | ||
app.listen(unsafe { TcpListener::from_raw_fd(fd) }).await?; | ||
} else { | ||
app.listen("http://localhost:7674").await?; | ||
} | ||
Ok(()) | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests {} |