API Reference nova v#0.18.1

View Source

Modules

Interface module for nova

Nova application behaviour callback

Nova Controller behaviour definition

CSRF protection plugin for Nova using the synchronizer token pattern.

This module is responsible for all the different return types a controller have. Nova is constructed in such way that it's really easy to extend it by using handlers. A handler is basically a module consisting of a function of arity 4. We will show an example of this.

Custom formatter for the Erlang OTP logger application which outputs single-line JSON formatted data

nova_multipart_handler that streams a file part to disk under a random name in InitArgs``dir. The client filename is never used in the path. The part is written as <name>.part and renamed on handle_end/1, so a file at its final name is always complete. Sweep dir for stale *.part files left by a process crash.

Behaviour for a nova_multipart_plugin file sink, configured as {Mod, InitArgs}. Chunks arrive straight off the socket, so a handler that writes each one away keeps memory flat regardless of upload size.

nova_multipart_handler that keeps a file part in memory. Bounded by the plugin's max_part_size and max_total_size, so use it for small attachments only.

Reads a multipart/form-data body and streams every file part to a nova_multipart_handler, chunk by chunk. Regular fields are collected under params and file parts under files, each as #{name, filename, content_type, result} where result is whatever the handler returned from handle_end/1.

Plugins can be run at two different times; either in the beginning or at the end of a request. They can modify both the actual request or the nova-state. A plugin is implemented with the nova_plugin behaviour and needs to implement three different functions: pre_request/2, post_request/2 and plugin_info/0.

Main manager for handling plugins

Pubsub system for Nova. It uses the pg/pg2 module.

Router module for nova. This module is responsible for compiling routes, dispatching requests to the correct handler and managing the routing table. It also exposes an API for modulating the routing table at runtime.

Host-aware routing trie. This is Nova's dispatch table: a map from host to a tree of path segments, where each terminal node holds one payload per comparator (HTTP method).

All kind of operations on sessions is handled by the nova_session-module. The module also presents a behaviour that can be used to create customized backends for the session-data.

Nova supervisor.

Callback controller for handling websockets