2022-02-12 04:54:13 -03:00
|
|
|
# serve
|
|
|
|
|
|
|
|
> Static file serving and directory listing.
|
|
|
|
> More information: <https://github.com/vercel/serve>.
|
|
|
|
|
|
|
|
- Start an HTTP server listening on the default port to serve the current directory:
|
|
|
|
|
|
|
|
`serve`
|
|
|
|
|
|
|
|
- Start an HTTP server on a specific [p]ort to serve a specific directory:
|
|
|
|
|
|
|
|
`serve -p {{port}} {{path/to/directory}}`
|
|
|
|
|
|
|
|
- Start an HTTP server with CORS enabled by including the `Access-Control-Allow-Origin: *` header in all responses:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`serve {{[-C|--cors]}}`
|
2022-02-12 04:54:13 -03:00
|
|
|
|
|
|
|
- Start an HTTP server on the default port rewriting all not-found requests to the `index.html` file:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`serve {{[-s|--single]}}`
|
2022-02-12 04:54:13 -03:00
|
|
|
|
|
|
|
- Start an HTTPS server on the default port using the specified certificate:
|
|
|
|
|
|
|
|
`serve --ssl-cert {{path/to/cert.pem}} --ssl-key {{path/to/key.pem}}`
|
|
|
|
|
|
|
|
- Start an HTTP server on the default port using a specific configuration file:
|
|
|
|
|
2025-04-12 15:42:06 +03:00
|
|
|
`serve {{[-c|--config]}} {{path/to/serve.json}}`
|
2022-02-12 04:54:13 -03:00
|
|
|
|
|
|
|
- Display help:
|
|
|
|
|
|
|
|
`serve --help`
|