Class: Implementation

Defined in: src/implementation.coffee

Direct Known Subclasses

DefaultImplementation

Instance Method Summary

Constructor Details

- (void) constructor()

Instance Method Details

- (void) getActions()

- (void) getMountedRoutes()

- (void) putAction(name, action)

- (void) removeAction(name)

- (void) setResponder(responder)

- (void) getResponder(responder)

- (void) use(middlewares, options = {})

Sets up one or more middleware to be used.

You can also specify conditions to decide whether to use a middleware or not depending on the invoked action.

Examples:

Using a middleware for any action

impl.use(authMiddleware);

Using a middleware only for unsafe HTTP methods

impl.use(authMiddleware, {if: function(action){
  return action.method != "get";
}});

Parameters:

  • middlewares (Array<Functions> or Function) one or more middleware to be used
  • options (Object) options to set up middlewares:

Options Hash: (option):

  • if (Function<Action>) specify a condition to decide whether to use a middleware or not depending on the invoked action.

- (void) middlewaresFor(action) (private)

- (void) mount(resource, app, mountPoint = "/")