diff --git a/.gitignore b/.gitignore index af0c50a..cd237a8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .Ruserdata .Renviron .httr-oauth +.DS_Store diff --git a/R/deploy.R b/R/deploy.R index b72982e..722a086 100644 --- a/R/deploy.R +++ b/R/deploy.R @@ -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 diff --git a/plumber.R b/plumber.R index 2d4840e..daea382 100644 --- a/plumber.R +++ b/plumber.R @@ -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. diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..db961e0 --- /dev/null +++ b/static/index.html @@ -0,0 +1,31 @@ + + + + + Tidy Tuesday API + + + +

Welcome!

+

+ 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, this is probably not what you are looking for. +

+

+ For details about this API, see the project readme. + For more information about Tidy Tuesday, check out the project page. +

+ + \ No newline at end of file