LinuxCommandLibrary

serve

TLDR

Serve current directory

$ serve
copy
Serve specific directory
$ serve [path/to/directory]
copy
Custom port
$ serve -p [8080]
copy
Listen on all interfaces
$ serve -l [0.0.0.0]
copy
Single page app mode
$ serve -s [path/to/spa]
copy
Enable CORS
$ serve -C
copy

SYNOPSIS

serve [-p port] [-l address] [-s] [options] [path]

DESCRIPTION

serve runs a static file server. It's quick local hosting.
Zero configuration. Just run and serve.
SPA mode supported. Redirect to index.html.
CORS enabled easily. Cross-origin requests.
HTTPS support. With certificate files.

PARAMETERS

-p PORT

Port number.
-l ADDRESS
Listen address.
-s
Single page app mode.
-C
Enable CORS.
-n
Disable clipboard copy.
-d
Debug mode.
--ssl-cert FILE
SSL certificate.

CAVEATS

Development use only. Not production server. Node.js required.

HISTORY

serve is developed by Vercel (formerly ZEIT) as a simple static file server for local development.

SEE ALSO

http-server(1), python(1), nginx(1)

Copied to clipboard