your (http) internet server playground.
unprecedented control meets simplicity + functionality.
The logic involved in processing a request has been kept as minimal as possible, while still providing desirable functionality and a framework for your control logic.
To simplify your control logic, a non-intrusive customizable delegation step is provided where one server that receives a request can delegate it to another server, based on the given request. This is useful for sending requests out to an API instance, or to a server instance that is customized for handling with a certain folder or url.
Lightnode's main intention is to provide a powerful platform for web server developers to implement their requirements. This means a framework for easily taking control to achieve the sorts of things desired, as well a collection of robust and simple utilities that can be plugged in to achieve common desires such as static file serving, error and statistic logging.
Scaling Server Hierarchy
Lightnode is designed such that it can have a hierarchy of server objects much the same way the browser has a hierarchy of document elements. A request can be delegated at each phase to a sub server instance that will deal with all requests of a certain kind (to a folder). These sub servers are created lazily as they are requested, and then stored so that the one object can handle all similar requests. This means you can have a simple setup with one server object handling all requests, you can then forward just some of the requests to customized instances, or you can forward each request to a different server instance.
Pre-Event Server Setup
Configuration of your server can be as simple as instantiating a server or as robust as subclassing the server object itself. With the delegation and hierarchy framework user's have a powerful ability to customize the server, and a focus on understandable logic makes this easy to do. The lazily generated server hierarchy allows users to customize the working of a server in a similar manner to how a browser's document tree behavior is customized prior to any requests are received. Simply requesting a certain sub server, for example 'style', will create a sub server instance that will be delegated to and only hold custom logic for that style folder.
Robust File Serving
Static file serving is currently the highest priority of lightnode, as it is a common functionality that need not be rebuilt by too many groups. It is also something that has often been difficult or impossible to exert sufficient control over. Lightnode comes with the usual features such as:
- virtual hosts
- customizable url to file routing
- custom directory indexing, mime-types and error pages
Providing more builtin power is a strong desire of lightnode in future. Highly efficient request statistics and logging is something that no server should live without. The design of lightnode also enables developers to easily implement their own custom utility to go with the file serving. The most common utilities will hopefully be bundled with lightnode.
In order to increase usefulness, lightnode tries to ensure that core functionality is provided as directly instructable components as opposed only being tangled in the greater system. Static file serving for example can be included in your custom node application simply by calling sendFile(), bypassing the delegation / locating / directory indexing aspects if desirable.