1.2.5 • Published 10 years ago

node-noginx v1.2.5

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

noginx

Build Status

It's a cache proxy middleware like logical nginx of node.js with expressjs.

Install

npm install node-noginx --save

Usage

app.use(noginx([ < RegExp > , {
    rule: < RegExp > , // route match rule
    maxAge: < Number > , // ms, the cache data expired time
    keyQueries: [ < String > , < String > ], // picking params of query as cache-key
    timeout: < Number >, //  ms, max waitting time when cache unhit
    gzip: < Boolean > // disable gzip or not
}]), {
    maxAge: 3 * 1000, // ms, default 3000
    maxQueueSize: 5000, // max request watting queue size, default 5000, it will responce 503 when queue is full 
    maxCache: 5000, // default 5000
    cacheFreePercent: < Float >, // free percentage of maxCache when cache is overflow 
    timeout: 100, // ms, default 500
    debug: < Boolean >, // whether log debug info
    logger: < Function > // Log function
})

Test

npm test

Doc

Proxy method

  • res.render

    	**override:** 
    
    		- res.render(tpl, data)
  • res.send

    	**override:** 
    
    		- res.render(statusCode, body)
    		- res.render(statusCode)
    		- res.render(body)
  • res.json

    override:

    		- res.json(obj)
  • res.redirect

    override:

      - res.redirect(url)

Proxy headers

  • Content-Type
  • Cache-Control

License

MIT

1.2.5

10 years ago

1.2.4

10 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.19

10 years ago

1.1.18

10 years ago

1.1.17

10 years ago

1.1.16

10 years ago

1.1.15

10 years ago

1.1.14

10 years ago

1.1.13

10 years ago

1.1.12

10 years ago

1.1.11

10 years ago

1.1.10

10 years ago

1.1.9

10 years ago

1.1.8

10 years ago

1.1.7

10 years ago

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago