runServer | R Documentation |
This is a convenience function that provides a simple way to call
startServer
, service
, and
stopServer
in the correct sequence. It does not return unless
interrupted or an error occurs.
runServer(host, port, app, interruptIntervalMs = NULL)
host |
A string that is a valid IPv4 or IPv6 address that is owned by
this server, which the application will listen on. |
port |
A number or integer that indicates the server port that should be listened on. Note that on most Unix-like systems including Linux and macOS, port numbers smaller than 1024 require root privileges. |
app |
A collection of functions that define your application. See
|
interruptIntervalMs |
Deprecated (last used in httpuv 1.3.5). |
If you have multiple hosts and/or ports to listen on, call the individual
functions instead of runServer
.
startServer
, service
,
stopServer
## Not run:
# A very basic application
runServer("0.0.0.0", 5000,
list(
call = function(req) {
list(
status = 200L,
headers = list(
'Content-Type' = 'text/html'
),
body = "Hello world!"
)
}
)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.