Socket
Socket
Sign inDemoInstall

serve-static

Package Overview
Dependencies
Maintainers
6
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serve-static - npm Package Compare versions

Comparing version 1.9.1 to 1.9.2

7

HISTORY.md

@@ -0,1 +1,8 @@

1.9.2 / 2015-03-14
==================
* deps: send@0.12.2
- Throw errors early for invalid `extensions` or `index` options
- deps: debug@~2.1.3
1.9.1 / 2015-02-17

@@ -2,0 +9,0 @@ ==================

8

package.json
{
"name": "serve-static",
"description": "Serve static files",
"version": "1.9.1",
"version": "1.9.2",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",

@@ -11,8 +11,8 @@ "license": "MIT",

"parseurl": "~1.3.0",
"send": "0.12.1",
"send": "0.12.2",
"utils-merge": "1.0.0"
},
"devDependencies": {
"istanbul": "0.3.5",
"mocha": "~2.1.0",
"istanbul": "0.3.7",
"mocha": "~2.2.1",
"supertest": "~0.15.0"

@@ -19,0 +19,0 @@ },

@@ -143,2 +143,6 @@ # serve-static

#### Simple
This is a simple example of using Express.
```js

@@ -154,2 +158,46 @@ var express = require('express')

#### Multiple roots
This example shows a simple way to search through multiple directories.
Files are look for in `public-optimized/` first, then `public/` second as
a fallback.
```js
var express = require('express')
var serveStatic = require('serve-static')
var app = express()
app.use(serveStatic(__dirname + '/public-optimized'))
app.use(serveStatic(__dirname + '/public'))
app.listen(3000)
```
#### Different settings for paths
This example shows how to set a different max age depending on the served
file type. In this example, HTML files are not cached, while everything else
is for 1 day.
```js
var express = require('express')
var serveStatic = require('serve-static')
var app = express()
app.use(serveStatic(__dirname + '/public', {
maxAge: '1d',
setHeaders: setCustomCacheControl
}))
app.listen(3000)
function setCustomCacheControl(res, path) {
if (serveStatic.mime.lookup(path) === 'text/html') {
// Custom Cache-Control for HTML files
res.setHeader('Cache-Control', 'public, max-age=0')
}
}
```
## License

@@ -159,13 +207,13 @@

[npm-image]: https://img.shields.io/npm/v/serve-static.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/serve-static.svg
[npm-url]: https://npmjs.org/package/serve-static
[travis-image]: https://img.shields.io/travis/expressjs/serve-static/master.svg?label=linux&style=flat
[travis-image]: https://img.shields.io/travis/expressjs/serve-static/master.svg?label=linux
[travis-url]: https://travis-ci.org/expressjs/serve-static
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-static/master.svg?label=windows&style=flat
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-static/master.svg?label=windows
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-static
[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-static/master.svg?style=flat
[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-static/master.svg
[coveralls-url]: https://coveralls.io/r/expressjs/serve-static
[downloads-image]: https://img.shields.io/npm/dm/serve-static.svg?style=flat
[downloads-image]: https://img.shields.io/npm/dm/serve-static.svg
[downloads-url]: https://npmjs.org/package/serve-static
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg?style=flat
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
[gratipay-url]: https://gratipay.com/dougwilson/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc