content-types
handle multiple content types
Last updated 12 years ago by raynos .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install content-types 
SYNC missed versions from official npm registry.

content-types build status

handle multiple content types

Example

var http = create("http")
    , contentTypes = require("routil-contentTypes")

http.createServer(function () {
    contentTypes(req, {
        "text/html": returnHtml
        , "application/javascript": returnJson
    })(req, res)
}).listen(8080)

function returnHtml(req, res) {
    res.end("<ul><li>foo</li><li>bar</li></ul>")
}

function returnJson(req, res) {
    res.end(JSON.stringify(["foo", "bar"]))
}

Installation

npm install content-types

Tests

npm test

Contributors

  • Raynos

MIT Licenced

Current Tags

  • 0.1.0                                ...           latest (12 years ago)

1 Versions

  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE