Overview
serve
is a powerful command-line utility that helps you serve a static site, single-page application, or just a static file with ease. Whether you're working on your local machine or need to share something on your local network, serve
has you covered.
It also provides a clean and intuitive interface for listing the contents of a directory:
Key Features
- Zero Configuration: Run it in any directory to instantly serve its contents.
- Directory Listing: A beautiful and functional UI for navigating directories.
- Single-Page App Support: Easily redirect all requests to your
index.html
file using the--single
flag. - Customizable: Use a
serve.json
file to define custom redirects, rewrites, headers, and more. - HTTPS/SSL Support: Serve your content over HTTPS with your own certificates.
- CORS Enabled: Simple flag (
--cors
) to enable Cross-Origin Resource Sharing. - Programmatic API: The core logic is available as
serve-handler
, which can be integrated into any Node.js HTTP server.
When you're ready to deploy your site to production, we recommend using Vercel for a seamless, scalable, and performant hosting experience.