Installations
npm install serve
Developer Guide
Typescript
No
Module System
ESM
Min. Node Version
>= 14
Node Version
18.20.4
NPM Version
10.7.0
Score
82.1
Supply Chain
95.2
Quality
83.8
Maintenance
100
Vulnerability
99.3
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (78.72%)
HTML (10.52%)
JavaScript (10.46%)
Shell (0.3%)
Developer
Download Statistics
Total Downloads
292,910,011
Last Day
172,041
Last Week
1,289,254
Last Month
5,718,833
Last Year
71,687,863
GitHub Statistics
9,470 Stars
769 Commits
693 Forks
101 Watching
5 Branches
156 Contributors
Package Meta Information
Latest Version
14.2.4
Package Id
serve@14.2.4
Unpacked Size
25.24 kB
Size
8.55 kB
File Count
4
NPM Version
10.7.0
Node Version
18.20.4
Publised On
15 Oct 2024
Total Downloads
Cumulative downloads
Total Downloads
292,910,011
Last day
-29.6%
172,041
Compared to previous day
Last week
-8.2%
1,289,254
Compared to previous week
Last month
-0.3%
5,718,833
Compared to previous month
Last year
-14.4%
71,687,863
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
serve
helps you serve a static site, single page application or just a static file (no matter if on your device or on the local network). It also provides a neat interface for listing the directory's contents:
Once it's time to push your site to production, we recommend using Vercel.
Usage
serve
v14 onwards requires Node v14 to run. Please useserve
v13 if you cannot upgrade to Node v14.
The quickest way to get started is to just run npx serve
in your project's directory.
If you prefer, you can also install the package globally (you'll need at least Node LTS):
1> npm install --global serve
Once that's done, you can run this command inside your project's directory...
1> serve
...or specify which folder you want to serve:
1> serve folder-name/
Finally, run this command to see a list of all available options:
1> serve --help
Now you understand how the package works! :tada:
Configuration
To customize serve
's behavior, create a serve.json
file in the public folder and insert any of these properties.
API
The core of serve
is serve-handler
, which can be used as middleware in existing HTTP servers:
1const handler = require('serve-handler'); 2const http = require('http'); 3 4const server = http.createServer((request, response) => { 5 // You pass two more arguments for config and middleware 6 // More details here: https://github.com/vercel/serve-handler#options 7 return handler(request, response); 8}); 9 10server.listen(3000, () => { 11 console.log('Running at http://localhost:3000'); 12});
You can also replace
http.createServer
withmicro
.
Issues and Contributing
If you want a feature to be added, or wish to report a bug, please open an issue here.
If you wish to contribute to the project, please read the contributing guide first.
Credits
This project used to be called list
and micro-list
. But thanks to TJ Holowaychuk handing us the new name, it's now called serve
(which is much more definite).
Author
Leo Lamprecht (@leo)
Stable Version
Stable Version
14.2.4
HIGH
5
7.5/10
Summary
Path Traversal in serve
Affected Versions
< 7.1.3
Patched Versions
7.1.3
0/10
Summary
Cross-Site Scripting in serve
Affected Versions
< 10.0.2
Patched Versions
10.0.2
0/10
Summary
Path Traversal in serve
Affected Versions
< 10.1.2
Patched Versions
10.1.2
0/10
Summary
Byass due to validation before canonicalization in serve
Affected Versions
< 6.5.2
Patched Versions
6.5.2
7.5/10
Summary
Directory Traversal in serve
Affected Versions
< 7.1.3
Patched Versions
7.1.3
MODERATE
4
5.3/10
Summary
vercel/serve allows access to restricted files if filename is URL encoded.
Affected Versions
< 6.5.2
Patched Versions
6.5.2
0/10
Summary
Cross-Site Scripting in serve
Affected Versions
< 10.0.2
Patched Versions
10.0.2
6.5/10
Summary
Directory Traversal in serve
Affected Versions
<= 6.4.8
Patched Versions
6.4.9
5.3/10
Summary
Information Exposure on Case Insensitive File Systems in serve
Affected Versions
< 7.0.0
Patched Versions
7.0.0
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: license.md:0
- Info: FSF or OSI recognized license: MIT License: license.md:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/vercel/.github/SECURITY.md:1
- Info: Found linked content: github.com/vercel/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/vercel/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/vercel/.github/SECURITY.md:1
Reason
2 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
Reason
Found 18/30 approved changesets -- score normalized to 6
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yaml:1
- Warn: no topLevel permission defined: .github/workflows/publish.yaml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/serve/ci.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/serve/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/serve/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/serve/ci.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/serve/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/serve/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/serve/publish.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/serve/publish.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/vercel/serve/publish.yaml/main?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 3 third-party GitHubAction dependencies pinned
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 20 are checked with a SAST tool
Score
5
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More