Socket
Socket
Sign inDemoInstall

serve

Package Overview
Dependencies
Maintainers
4
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serve

Static file serving and directory listing


Version published
Weekly downloads
1.3M
decreased by-1.24%
Maintainers
4
Weekly downloads
 
Created

What is serve?

The serve npm package is a static file serving and directory listing package that allows you to serve static files over HTTP quickly and easily. It is often used for hosting single-page applications, static websites, or for serving files during development.

What are serve's main functionalities?

Serving static files

This command starts a static file server in the specified directory. By default, it listens on port 5000, but you can specify another port with the -l flag.

npx serve /path/to/static/files

Directory listing

Running serve without any arguments serves the current directory and provides a directory listing if no index.html file is found.

npx serve

Single-page application mode

The -s flag enables single-page application mode, which rewrites all not-found requests to /index.html, allowing for client-side routing.

npx serve -s /path/to/spa

Custom port

This command starts the server on a custom port, in this case, port 4000.

npx serve -l 4000

SSL/TLS

Serve can also provide content over HTTPS by specifying the paths to the SSL certificate and key files.

npx serve --ssl-cert /path/to/cert.pem --ssl-key /path/to/key.pem

Other packages similar to serve

Keywords

FAQs

Package last updated on 12 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc