NOTICE: Node server API changes


#1

Hi All,

Just wanted to tell you that I have finally gotten around to clean up the request/response portion of the Node Server API.

I was not happy with the number of arguments passed to methods and their order(s) and consistency.

I think we all can agree that this is a lot cleaner :slight_smile:

So, if you have a custom handler or server-side extension – You need to REFACTOR right away!.

The Application API has not been touched. So you don’t have to update your applications

Before

// API
module.exports.METHOD = function(args, callback, request, response, config, handler) {};

// VFS
module.exports.METHOD = function(args, request, callback, config) {};

// Handler
Handler.prototype.METHOD = function(request, response, arg, ..., callback) {};

After

// API
module.exports.METHOD = function(server, args, callback) {};

// VFS
module.exports.METHOD = function(server, args, callback) {};

// Handler
Handler.prototype.METHOD = function(server, arg, ..., callback) {};

Documentation

The server object comes with:

  • config The current config generated form src/conf “server” namespace
  • request The HTTP request object
  • response The HTTP response object
  • handler The current OS.js Handler

Reference


UPDATE: Version bump - alpha77
#2