freon
Fast server-side web framework
Example
const Freon = ;const app = 'example.com' /.+\.example\.com/;app;
API
const Freon = ;
Freon.Application
Plugins
Plugins are trivial to create for freon. For example, a plugin that injects a property foo
into the request object and sets it to 'bar'
:
// fooBarPlugin.js module { reqfoo = 'bar'; ;}
Note that it is vital to call next()
when the plugin is finished loading. If any plugin does not call next()
, then the server will halt when it is requested, waiting for that plugin to load, which it never will.
To load this plugin:
// server.js const app = 'example.com';app;
static
Use Freon.static
to serve a static folder. It will be compressed using gzip
and deflate
, send the Last-Modified
header, and send 304
status codes without a body when possible. If the file is not found in the directory, it will then pass on the request to the next handlers.
const app = 'example.com';app;
Other useful plugins
You may find these plugins useful:
Freon will overwrite the request and response object. See the properties and methods that are added: