-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
shinyServer.Rd
58 lines (52 loc) · 2.01 KB
/
shinyServer.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/server.R
\name{shinyServer}
\alias{shinyServer}
\title{Define Server Functionality}
\usage{
shinyServer(func)
}
\arguments{
\item{func}{The server function for this application. See the details section
for more information.}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}}
Defines the server-side logic of the Shiny application. This generally
involves creating functions that map user inputs to various kinds of output.
In older versions of Shiny, it was necessary to call \code{shinyServer()} in
the \code{server.R} file, but this is no longer required as of Shiny 0.10.
Now the \code{server.R} file may simply return the appropriate server
function (as the last expression in the code), without calling
\code{shinyServer()}.
Call \code{shinyServer} from your application's \code{server.R}
file, passing in a "server function" that provides the server-side logic of
your application.
The server function will be called when each client (web browser) first loads
the Shiny application's page. It must take an \code{input} and an
\code{output} parameter. Any return value will be ignored. It also takes an
optional \code{session} parameter, which is used when greater control is
needed.
See the \href{https://shiny.rstudio.com/tutorial/}{tutorial} for more
on how to write a server function.
}
\examples{
\dontrun{
# A very simple Shiny app that takes a message from the user
# and outputs an uppercase version of it.
shinyServer(function(input, output, session) {
output$uppercase <- renderText({
toupper(input$message)
})
})
# It is also possible for a server.R file to simply return the function,
# without calling shinyServer().
# For example, the server.R file could contain just the following:
function(input, output, session) {
output$uppercase <- renderText({
toupper(input$message)
})
}
}
}
\keyword{internal}