File: runServer.Rd

package info (click to toggle)
r-cran-httpuv 1.6.15%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,292 kB
  • sloc: ansic: 6,499; cpp: 5,501; makefile: 103; sh: 56
file content (55 lines) | stat: -rw-r--r-- 1,555 bytes parent folder | download
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/httpuv.R
\name{runServer}
\alias{runServer}
\title{Run a server}
\usage{
runServer(host, port, app, interruptIntervalMs = NULL)
}
\arguments{
\item{host}{A string that is a valid IPv4 or IPv6 address that is owned by
this server, which the application will listen on. \code{"0.0.0.0"}
represents all IPv4 addresses and \code{"::/0"} represents all IPv6
addresses.}

\item{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.}

\item{app}{A collection of functions that define your application. See
\code{\link{startServer}}.}

\item{interruptIntervalMs}{Deprecated (last used in httpuv 1.3.5).}
}
\description{
This is a convenience function that provides a simple way to call
\code{\link{startServer}}, \code{\link{service}}, and
\code{\link{stopServer}} in the correct sequence. It does not return unless
interrupted or an error occurs.
}
\details{
If you have multiple hosts and/or ports to listen on, call the individual
functions instead of \code{runServer}.
}
\examples{
\dontrun{
# 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!"
      )
    }
  )
)
}
}
\seealso{
\code{\link{startServer}}, \code{\link{service}},
\code{\link{stopServer}}
}