-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from kennedymwavu/25-how-to-handle-cors-in-amb…
…iorix ft: how to handle cors in ambiorix
- Loading branch information
Showing
14 changed files
with
2,499 additions
and
194 deletions.
There are no files selected for viewing
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 @@ | ||
source("renv/activate.R") |
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,23 @@ | ||
# CORS middleware | ||
|
||
This example shows how you can add a CORS middleware to your API. | ||
|
||
This is useful when making cross-origin requests from the browser (client-side). | ||
|
||
# Run API | ||
|
||
1. `cd` into the `14_cors/` dir: | ||
|
||
```bash | ||
cd 14_cors/ | ||
``` | ||
1. Fire up R and restore package dependencies: | ||
|
||
```r | ||
renv::restore() | ||
``` | ||
1. `server.R` is the entry point. Run this command in the terminal to start the API: | ||
|
||
```bash | ||
Rscript server.R | ||
``` |
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,225 @@ | ||
{ | ||
"R": { | ||
"Version": "4.3.3", | ||
"Repositories": [ | ||
{ | ||
"Name": "CRAN", | ||
"URL": "https://packagemanager.posit.co/cran/latest" | ||
} | ||
] | ||
}, | ||
"Packages": { | ||
"R6": { | ||
"Package": "R6", | ||
"Version": "2.5.1", | ||
"Source": "Repository", | ||
"Repository": "RSPM", | ||
"Requirements": [ | ||
"R" | ||
], | ||
"Hash": "470851b6d5d0ac559e9d01bb352b4021" | ||
}, | ||
"Rcpp": { | ||
"Package": "Rcpp", | ||
"Version": "1.0.13", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"methods", | ||
"utils" | ||
], | ||
"Hash": "f27411eb6d9c3dada5edd444b8416675" | ||
}, | ||
"ambiorix": { | ||
"Package": "ambiorix", | ||
"Version": "2.1.0", | ||
"Source": "GitHub", | ||
"RemoteType": "github", | ||
"RemoteHost": "api.github.com", | ||
"RemoteRepo": "ambiorix", | ||
"RemoteUsername": "devOpifex", | ||
"RemoteRef": "HEAD", | ||
"RemoteSha": "98cdac33cf07294567deec3b55d289bfa1782d37", | ||
"Requirements": [ | ||
"R", | ||
"assertthat", | ||
"cli", | ||
"fs", | ||
"glue", | ||
"httpuv", | ||
"jsonlite", | ||
"log", | ||
"methods" | ||
], | ||
"Hash": "65c7edf399518693afbc3a581040586f" | ||
}, | ||
"assertthat": { | ||
"Package": "assertthat", | ||
"Version": "0.2.1", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"tools" | ||
], | ||
"Hash": "50c838a310445e954bc13f26f26a6ecf" | ||
}, | ||
"box": { | ||
"Package": "box", | ||
"Version": "1.2.0", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"R", | ||
"tools" | ||
], | ||
"Hash": "d94049c1d9446b0abb413fde9e82a505" | ||
}, | ||
"cli": { | ||
"Package": "cli", | ||
"Version": "3.6.3", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"R", | ||
"utils" | ||
], | ||
"Hash": "b21916dd77a27642b447374a5d30ecf3" | ||
}, | ||
"crayon": { | ||
"Package": "crayon", | ||
"Version": "1.5.3", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"grDevices", | ||
"methods", | ||
"utils" | ||
], | ||
"Hash": "859d96e65ef198fd43e82b9628d593ef" | ||
}, | ||
"fastmap": { | ||
"Package": "fastmap", | ||
"Version": "1.2.0", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Hash": "aa5e1cd11c2d15497494c5292d7ffcc8" | ||
}, | ||
"fs": { | ||
"Package": "fs", | ||
"Version": "1.6.4", | ||
"Source": "Repository", | ||
"Repository": "RSPM", | ||
"Requirements": [ | ||
"R", | ||
"methods" | ||
], | ||
"Hash": "15aeb8c27f5ea5161f9f6a641fafd93a" | ||
}, | ||
"glue": { | ||
"Package": "glue", | ||
"Version": "1.7.0", | ||
"Source": "Repository", | ||
"Repository": "RSPM", | ||
"Requirements": [ | ||
"R", | ||
"methods" | ||
], | ||
"Hash": "e0b3a53876554bd45879e596cdb10a52" | ||
}, | ||
"httpuv": { | ||
"Package": "httpuv", | ||
"Version": "1.6.15", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"R", | ||
"R6", | ||
"Rcpp", | ||
"later", | ||
"promises", | ||
"utils" | ||
], | ||
"Hash": "d55aa087c47a63ead0f6fc10f8fa1ee0" | ||
}, | ||
"jsonlite": { | ||
"Package": "jsonlite", | ||
"Version": "1.8.8", | ||
"Source": "Repository", | ||
"Repository": "RSPM", | ||
"Requirements": [ | ||
"methods" | ||
], | ||
"Hash": "e1b9c55281c5adc4dd113652d9e26768" | ||
}, | ||
"later": { | ||
"Package": "later", | ||
"Version": "1.3.2", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"Rcpp", | ||
"rlang" | ||
], | ||
"Hash": "a3e051d405326b8b0012377434c62b37" | ||
}, | ||
"log": { | ||
"Package": "log", | ||
"Version": "1.1.1", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"R6", | ||
"cli", | ||
"crayon" | ||
], | ||
"Hash": "4af07aedf6d8f2f8cf037511cdda2fb5" | ||
}, | ||
"magrittr": { | ||
"Package": "magrittr", | ||
"Version": "2.0.3", | ||
"Source": "Repository", | ||
"Repository": "RSPM", | ||
"Requirements": [ | ||
"R" | ||
], | ||
"Hash": "7ce2733a9826b3aeb1775d56fd305472" | ||
}, | ||
"promises": { | ||
"Package": "promises", | ||
"Version": "1.3.0", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"R6", | ||
"Rcpp", | ||
"fastmap", | ||
"later", | ||
"magrittr", | ||
"rlang", | ||
"stats" | ||
], | ||
"Hash": "434cd5388a3979e74be5c219bcd6e77d" | ||
}, | ||
"renv": { | ||
"Package": "renv", | ||
"Version": "1.0.2", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"utils" | ||
], | ||
"Hash": "4b22ac016fe54028b88d0c68badbd061" | ||
}, | ||
"rlang": { | ||
"Package": "rlang", | ||
"Version": "1.1.4", | ||
"Source": "Repository", | ||
"Repository": "CRAN", | ||
"Requirements": [ | ||
"R", | ||
"utils" | ||
], | ||
"Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" | ||
} | ||
} | ||
} |
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,7 @@ | ||
library/ | ||
local/ | ||
cellar/ | ||
lock/ | ||
python/ | ||
sandbox/ | ||
staging/ |
Oops, something went wrong.