Normally there is no need to create a new HostHttpServer, instead use the start method of the host instance.

HostHttpServer

Format

R6Class.

Details

Note for developers: the general approach taken in developing this class is to mirror implementations in Node and Python to make it easier to port code between the languages and ensure consisten implementations.

new()

host

The host to be served

address

The port to listen on. Default '127.0.0.1'

port

The port to listen on. Default 2000

start()

Start the server

stop()

Stop the server

handle()

Handle a HTTP request

route()

Route a HTTP request

static()

Handle a request for a static file

run()

Handle a request to call a host method

error()

Generate an error response

error400()

Generate a 400 error

error401()

Generate a 401 error

error403()

Generate a 403 error

error404()

Generate a 404 error

error500()

Generate a 500 error

address

The address of the server

port

The port of the server

url

The URL of the server, or NULL if not yet started