mirror of
https://github.com/openfaas/faas.git
synced 2025-06-19 20:46:41 +00:00
add R sample function and readme
Signed-off-by: Chanyub Park <mrchypark@gmail.com>
This commit is contained in:
42
sample-functions/BaseFunctions/R/README.Rmd
Normal file
42
sample-functions/BaseFunctions/R/README.Rmd
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
title: "BaseFunction for R"
|
||||
output: github_document
|
||||
---
|
||||
|
||||
```{r setup, include=FALSE}
|
||||
knitr::opts_chunk$set(echo = TRUE)
|
||||
```
|
||||
|
||||
Use this FaaS function using R.
|
||||
|
||||
**Deploy the base R function**
|
||||
|
||||
(Make sure you have already deployed FaaS with ./deploy_stack.sh in the root of this Github repository.
|
||||
|
||||
* Option 1 - click *Create a new function* on the FaaS UI
|
||||
|
||||
* Option 2 - use the [faas-cli](https://github.com/alexellis/faas-cli/) (experimental)
|
||||
|
||||
```
|
||||
# curl -sSL https://get.openfaas.com | sudo sh
|
||||
|
||||
# faas-cli -action=deploy -image=functions/base:R-3.4.1-alpine -name=baser
|
||||
200 OK
|
||||
URL: http://localhost:8080/function/baser
|
||||
```
|
||||
|
||||
**Say Hi with input**
|
||||
|
||||
`curl` is good to test function.
|
||||
|
||||
```
|
||||
$ curl http://localhost:8080/function/baser -d "test"
|
||||
```
|
||||
|
||||
**Customize the transformation**
|
||||
|
||||
If you want to customise the transformation then edit the Dockerfile or the fprocess variable and create a new function.
|
||||
|
||||
**Remove the function**
|
||||
|
||||
You can remove the function with `docker service rm baser`.
|
Reference in New Issue
Block a user