1.0.0 • Published 7 years ago

teo-body-parser v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

teo-body-parser

Teo.JS body parser middleware based on Express.js body-parser module.

This module provides support for all of the wrapped API:

Teo.JS Config Example

module.exports = {
    protocol: "http",
    host: "localhost",
    port: 3100,
    cluster: {
        enabled: true
    },
    extensions: [
        {
            name: "body-parser",
            module: "teo-body-parser",
            config: {
               // enables all parsers with the default options
               json: true,
               urlencoded: true,
               raw: true,
               text: true
            }
        }
    ],
};

When passing json: true - no options will be passed, and the parser will be enabled with the default options as bodyParser.json().

Alternatively, if you want to pass the additional configuration options for some specific parser, just replace true with your configuration object. E.g.

extensions: [
    {
        name: "body-parser",
        module: "teo-body-parser",
        config: {
           json: true,
           // will apply bodyParser.urlencoded({extended: true})
           urlencoded: { extended: true },
           raw: true,
           text: true
        }
    }
],