Neolithic Psychedelic Mushrooms
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

expressive-router

0.0.0 • Public • Published

expressive-router

Alternate router for express. Matches request and handler based on request headers, params, and content negotiation

app.get("/?x=something&y=", "Content-Type: text/plain", "produces=html", function(req, res){
    var params = req.params
    params.x // "something"
    params.hasOwnProperty("y") // true
    req.header["Content-Type"] // text/plain, text/*, */*
    req.header["Accepts"] //application/json
    
    res.json("<h1>Say: Hello World!</h1>");
})
app.get("/?x=something&y=", "Content-Type: text/plain", "produces=json", function(req, res){
    var params = req.params
    params.x // "something"
    params.hasOwnProperty("y") // true
    req.header["Content-Type"] // text/plain, text/*, */*
    req.header["Accepts"] //application/json
    
    res.json({"say": "Hello World!"})
})

Keywords

none

install

npm i expressive-router

Downloadsweekly downloads

1

version

0.0.0

license

none

last publish

collaborators

  • avatar
Report a vulnerability