server_nano library

Classes

Close
ContextRequest
The ContextRequest class wraps Dart's native HttpRequest object, providing a convenient interface for accessing request data such as headers, query parameters, cookies, and payloads, as well as determining the request's content type. It too abstracts away the complexity of handling different types of HTTP requests, making it easier for developers to access the data they need without delving into the lower-level details of parsing request headers, cookies, and payloads. It's a helpful utility for web server development in Dart, especially when building RESTful APIs or handling form submissions.
ContextResponse
This class contains the response of the request. It is used to set the headers, cookies, status code and send the response with the type given (json, html, text, etc). You can also add a callback that will be called when the response is disposed.
Cors
Cors class is a middleware that adds CORS headers to the response.
Handler
HasCurrentIterator<E>
Helmet
Helmet is a collection of 6 smaller middleware functions that set security-related HTTP headers:
HttpMultipartFormData
This class represents a parsed multipart/form-data payload, providing access to the payload's content type, content disposition, and content transfer encoding.
MatchResult
A class representing the result of a route matching operation.
Middleware
Middleware class has a handler function that executes before the route handler and can be used to perform operations like logging, authentication, etc.
MultipartUpload
This class is used to encapsulate the data of a file upload or form field in a request payload. It contains the name, MIME type, content transfer encoding, and raw bytes of the file or field data.
NanoSocket
NanoSocket is a class that represents a WebSocket connection. It has methods to send messages, emit events, close the connection, and more. It also has methods to handle rooms, broadcast messages, and emit events to all connected sockets. It is used in the WebSocket handler to manage the WebSocket connections.
RouteTree
A class representing a routing tree that is used to match routes to handlers.
RouteTreeResult
A class representing a route tree result. Contains a MatchResult and a Handler.
Server
VirtualDirectory
A VirtualDirectory can serve files and directory-listing from a root path, to HttpRequests.

Enums

Method
Enum indicating the HTTP method used for the request.
ServerMode

Extensions

FirstWhereExt on Iterable<T>

Functions

logger(String value, {bool isError = false}) → void

Typedefs

CloseSocket = void Function(Close)
DisposeCallback = void Function()
HttpHandler = void Function(ContextRequest req, ContextResponse res)
MessageSocket = void Function(dynamic val)
OpenSocket = void Function(NanoSocket socket)
WsHandler = void Function(NanoSocket socket)