Minimal code

With Cendre, you can code your own dynamic pages. They have the .nodejs extension by default.
It's both easy and powerfull. Here is the minimal code :

exports.mimetype = 'text/plain';
exports.encoding = 'utf-8'; = function(c, end)
	end('Hello world !');

It will return an UTF-8 encoded .txt file with "Hello world !" as content.

The mimetype parameter

Set the content type of the response here. Example : 'text/html' for an .html page.

The encoding parameter

For the response body, there are three types of encoding supported by Cendre :

'utf-8'		// Recommended.
'utf-16'	// If you don't like text browsers.
null		// If you return a node.js buffer. (binary data)

NB : The encoding of the response headers is always UTF-8.

The c object

cookie,				// Associative array of cookies stored by the client.
cookie_set,			// Add a cookie. Usage : cookie_set('name', 'value'(optional), 25 (optional max-age in s));
cookie_unset,		// Remove a cookie. Usage : cookie_unset('name');
data,				// Raw request body if it is not too big.
file,				// If the request body is too big, it is stored in the temporary folder with this filename.
get,				// Associative array of GET parameters.
incoming_message,	// The raw request object.
m,					// Modules path.
path,				// Current path.
post,				// Associative array of POST parameters.
rest,				// Array of pathname parameters.
root,				// Absolute path of the webfolder's root.
server_response,	// The raw response object.
session,			// Associative array of SESSION parameters.
session_start,		// Start the session. Usage : session_start(true (optional, force to create an empty session));
session_stop		// Stop the session. Usage : session_stop();

The end function

Pass the response body in parameter. The response will be sent as soon as you call it.
You can write code after this call to execute some actions after the response is sent.