Serve

The Serve class contains the whole logic of the program. It is to be used when linking to this program.

Constructors

this
this(string host = "127.0.0.1", short port = 8000, string file = ".", bool verbose = false)

Constructor

Members

Functions

addBuildPaths
URLRouter addBuildPaths()

Depending on the type of file: - file: serve the file only; - directory: build a listdir representation;

infoVerbose
void infoVerbose(HTTPServerRequest req, HTTPServerResponse res)

Function to override if custom informations are to be printed.

serve
void serve()

Serve the directory specified using a Vibe.d event loop. The function first binds using the settings of the class then exectues the event loop.

serveIndex
void serveIndex(HTTPServerRequest req, HTTPServerResponse res)

Replies to request. Serve a file or build a listdir representation in case of a directory. It uses a diet template for the latter.

stop
void stop()

Stop the event loop. It is automatically called at scope(exit)

Meta