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!"})
})

Dependents (0)

Package Sidebar

Install

npm i expressive-router

Weekly Downloads

1

Version

0.0.0

License

none

Last publish

Collaborators

  • juzerali