PetitHTTPD class

A Simple HTTP Daemon.

Constructors

PetitHTTPD(Directory documentRoot, {int port = 80, int securePort = 443, String bindingAddress = 'localhost', bool setHeaderCacheControl = true, String? headerCacheControl, bool setCORSHeaders = true, bool redirectToHTTPS = true, bool allowLetsEncrypt = true, Map<String, String>? domains, Directory? letsEncryptDirectory})

Properties

allowLetsEncrypt bool
If true allows Let's Encrypt.
final
bindingAddress String
The server socket binding address: Default: localhost.
final
documentRoot Directory
The document root Directory.
final
domains Map<String, String>?
The domains to use with Let's Encrypt.
final
hashCode int
The hash code for this object.
no setterinherited
headerCacheControl String?
Personalized value for the header Cache-Control. Will be used if setHeaderCacheControl is true.
final
isLetsEncryptEnabled bool
Returns true if Let's Encrypt is enabled and all prerequisites are accomplished.
no setter
letsEncryptDirectory Directory?
The Let's Encrypt Directory
final
port int
The port number. Default: 80.
final
redirectToHTTPS bool
If true and a SecureServer is being started
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
securePort int
The secure port (HTTPS) number. Default: 443.
final
setCORSHeaders bool
If true CORS` headers will be set for successful responses.
final
setHeaderCacheControl bool
If true the Cache-Control header will be set for successful responses.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start() Future<bool>
Starts the daemon.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getOrigin(Request request) String?
getRemoteAddress(Request request) String?
setHeadersCORS(Request request, Response response, {Map<String, String>? headers}) Map<String, String>