working on example app
This commit is contained in:
parent
6ea0b67993
commit
1907e35fdf
@ -5,12 +5,12 @@ get_hist <- ts_function(
|
||||
h <- hist(faithful$waiting, breaks = bins, plot = FALSE)
|
||||
data.frame(x = h$mids, y = h$density)
|
||||
},
|
||||
result = ts_dataframe(eruptions = ts_numeric(), waiting = ts_numeric())
|
||||
result = ts_dataframe(x = ts_numeric(0), y = ts_numeric(0))
|
||||
)
|
||||
get_smoother <- ts_function(
|
||||
function(bandwidth = ts_numeric(1)) {
|
||||
d <- density(faithful$waiting, bw = bandwidth)
|
||||
data.frame(x = d$x, y = d$y)
|
||||
},
|
||||
result = ts_dataframe(x = ts_numeric(), y = ts_numeric())
|
||||
result = ts_dataframe(x = ts_numeric(0), y = ts_numeric(0))
|
||||
)
|
||||
|
||||
@ -34,9 +34,7 @@ source('faithful-app.R')
|
||||
get_hist$call(10)
|
||||
```
|
||||
|
||||
That's it! We'll use `ts_deploy()` later to create the server code and Typescript schema for the app.
|
||||
|
||||
TODO: call ts_compile() from ts_deploy()?
|
||||
That's it! We'll use `ts_compile()` later to create the server code and Typescript schema for the app.
|
||||
|
||||
## Create the React app
|
||||
|
||||
@ -57,7 +55,7 @@ pnpm install rserve-ts zod
|
||||
|
||||
### Create the server code
|
||||
|
||||
We now use the `ts_deploy()` function to create two files:
|
||||
We now use the `ts_compile()` function to create two files:
|
||||
|
||||
- `faithful-app.rserve.R` is the file that will start the Rserve instance with your apps functions available.
|
||||
- `faithful-app.rserve.ts` contains the TypeScript schema (using [zod](https://zod.dev)) that will let you use the R functions directly in the app like any other typescript function!
|
||||
@ -65,8 +63,7 @@ We now use the `ts_deploy()` function to create two files:
|
||||
We'll send these straight to the `faithful-demo/src` directory.
|
||||
|
||||
```r
|
||||
ts_compile('faithful-app.R', file = 'faithful-demo/src/faithful-app.rserve.ts')
|
||||
ts_deploy('faithful-app.R', file = 'faithful-demo/src/faithful-app.rserve.R')
|
||||
ts_compile('faithful-app.R', filename = 'faithful-demo/src/faithful-app.rserve')
|
||||
```
|
||||
|
||||
### Write the app
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user