Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Mar 31, 2024 via pnpm

serve-static 1.8.0

Serve static files
Package summary
Share
10
issues
3
critical severity
license
3
4
high severity
vulnerability
4
2
moderate severity
vulnerability
2
1
low severity
vulnerability
1
2
licenses
13
MIT
3
N/A
Package created
6 Mar 2014
Version published
6 Jan 2015
Maintainers
1
Total deps
16
Direct deps
4
License
MIT

Issues

10

3 critical severity issues

critical
Recommendation: Check the package code and files for license information
via: escape-html@1.0.1 & others
Recommendation: Check the package code and files for license information
via: send@0.11.0
Recommendation: Check the package code and files for license information
via: send@0.11.0
Collapse
Expand

4 high severity issues

high
Recommendation: Upgrade to version 0.5.2 or later
via: send@0.11.0
Recommendation: Upgrade to version 1.4.1 or later
via: send@0.11.0
Recommendation: Upgrade to version 2.6.9 or later
via: send@0.11.0
Recommendation: Upgrade to version 0.7.1 or later
via: send@0.11.0
Collapse
Expand

2 moderate severity issues

moderate
Recommendation: Upgrade to version 2.0.0 or later
via: send@0.11.0
Recommendation: Upgrade to version 0.11.1 or later
via: send@0.11.0
Collapse
Expand

1 low severity issue

low
Recommendation: Upgrade to version 2.6.9 or later
via: send@0.11.0
Collapse
Expand

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
13 Packages, Including:
crc@3.2.1
debug@2.1.3
depd@1.0.1
destroy@1.0.3
ee-first@1.1.0
etag@1.5.1
fresh@0.2.4
on-finished@2.2.1
parseurl@1.3.3
range-parser@1.0.3
send@0.11.0
serve-static@1.8.0
utils-merge@1.0.0

N/A

N/A
3 Packages, Including:
escape-html@1.0.1
mime@1.2.11
ms@0.7.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

4
All Dependencies CSV
β“˜ This is a list of serve-static 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
escape-html1.0.1783 BUNKNOWN
prod
1
parseurl1.3.33.86 kBMIT
prod
send0.11.09.57 kBMIT
prod
3
4
2
1
utils-merge1.0.01.65 kBMIT
prod

Visualizations

Frequently Asked Questions

What does serve-static do?

The serve-static module in Node.js is a middleware used for serving static files. These files are served from a specific root directory. The file to be served is determined by the combination of req.url with the provided root directory. If the file isn't found, instead of sending a 404 response, the module will call next() to move on to the next middleware, thereby allowing for stacking and fall-backs.

How do you use serve-static?

In order to use serve-static, you first need to install it by running npm install serve-static in your terminal. Once installed, you can require it in your application like this:

var serveStatic = require('serve-static')

Afterwards, you can set up the middleware to serve files from a specific directory. For example, to serve files from a directory named public, use the code below:

// Serve up public/ftp folder
var serve = serveStatic('public/ftp', { index: ['index.html', 'index.htm'] })

Here, serve is a function, which can be used with an HTTP Server object:

var finalhandler = require('finalhandler')
var http = require('http')
var serveStatic = require('serve-static')

var serve = serveStatic('public/ftp', { index: ['index.html', 'index.htm'] })

var server = http.createServer(function onRequest (req, res) {
  serve(req, res, finalhandler(req, res))
})

server.listen(3000)

In this example, the server listens on port 3000, and files in the public/ftp directory can be accessed by browsing to http://localhost:3000. The { index: ['index.html', 'index.htm'] } option specifies that index.html or index.htm will be served when a request targets a directory.

Where are the serve-static docs?

The serve-static documentation is available in the README file on the GitHub project page. More in-depth details can be found directly on the GitHub repository for serve-static. By visiting the link, users can access comprehensive information about API usage, available options, and several code examples demonstrating how to use serve-static in various settings.