content-types
handle multiple content types
Last updated 14 years ago by raynos .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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 (14 years ago)

1 Versions

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

Copyright 2013 - present © cnpmjs.org | Home |