Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a landing page #3

Merged
merged 2 commits into from
Jun 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.Ruserdata
.Renviron
.httr-oauth
.DS_Store
17 changes: 14 additions & 3 deletions R/deploy.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,21 @@ plumberDeploy::do_deploy_api(
path = "TidyTuesday",
localPath = ".",
port = 8002,
docs = TRUE
forward = TRUE,
overwrite = TRUE
)

# NOTE:
# .Renviron doesn't deploy (i think because it starts with a '.'?)
# NOTES:
# 1. .Renviron doesn't deploy (i think because it starts with a '.'?)
# so need to add it at var/plumber/TidyTuesday
# then reboot with 'sudo reboot now' for changes to take affect
# 2. plumber has a bug where if serving static files at /, docs give a 404
# so for now, set docs=FALSE (default). later, can add if desired
# see plumber PR #748
# 3. forward=TRUE points requests for / to /TidyTuesday, where this project
# lives. didn't have that at first. so this is a reminder of why
# see https://community.rstudio.com/t/what-does-plumberdeploy-do-forward-do/107304
# 4. see ?plumberDeploy::do_provision() Details for how to
# a. restart plumber: systemctl restart plumber-TidyTuesday
# b. see plumber logs: journalctl -u plumber-TidyTuesday
# logs from last 5 minutes: journalctl -u plumber-TidyTuesday -S -5m
8 changes: 6 additions & 2 deletions plumber.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ library(mongolite)
library(jsonlite)

#* @apiTitle Tidy Tuesday API
#* @apiDescription This is an API to access data sets from the Tidy Tuesday project. You can find out more about Tidy Tuesday [here](https://github.com/rfordatascience/tidytuesday).
#* @apiVersion 0.0.0.9000
#* @apiDescription This is an API to access data sets from the Tidy Tuesday project. For more information about this API, see the [project GitHub](https://github.com/asbates/tidytuesdayapi). You can find out more about Tidy Tuesday on it's [home page](https://github.com/rfordatascience/tidytuesday).
#* @apiVersion 0.0.1

# serves the landing page
#* @assets ./static /
list()

#* Get information about available data sets, like date and description.
#* @param limit Limit the number of results to return.
Expand Down
31 changes: 31 additions & 0 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tidy Tuesday API</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');

body {
font-family: 'Poppins', sans-serif;
background-color: #F5F5F5;
}

h1, p {
text-align: center;
}
</style>
</head>
<body>
<h1>Welcome!</h1>
<p>
Welcome to the Tidy Tuesday web API!
This is an API to access data sets from the Tidy Tuesday project.
Why we welcome you here, <strong>this is probably not what you are looking for.</strong>
</p>
<p>
For details about this API, see <a href="https://github.com/asbates/tidytuesdayapi">the project readme.</a>
For more information about Tidy Tuesday, check out the <a href="https://github.com/rfordatascience/tidytuesday">project page.</a>
</p>
</body>
</html>