koalesce-mw-response-types

0.1.1 • Public • Published

Response Content Type Middleware for Koalesce

This module is Koalesce middleware that sets the response content type for a route and validates the output. Output validation is ususally restricted to the dev and test environments.

If that sentence doesn't mean anything to you, you can always start here: koalesce-starter. (A working starter app built using angular, koa, node, and mongo.)

Route Fields

The response types middleware checks for the responseContentType field on a route. This field can be any of the following types:

  • text
  • html
  • json
  • file

Full example:

routes: {
    example: {
        url: '/route',
        method: 'POST',
        responseContentType: 'json',
        handler: function* () {
            console.log('done');
        }
    }
}

Other examples:

responseContentType: 'html'
responseContentType: 'file'

Koalesce Middleware Metadata

There is no metadata for this module.

Configuration Options

There are no configuration options.

Readme

Keywords

none

Package Sidebar

Install

npm i koalesce-mw-response-types

Weekly Downloads

2

Version

0.1.1

License

ISC

Last publish

Collaborators

  • madams5