LinuxCommandLibrary

serve

Static file server for local development

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 is a zero-configuration static file server for local development, created by Vercel. It serves the contents of a directory over HTTP with no setup required — just run serve in any directory to start hosting files.
Single-page application (SPA) mode redirects all routes to index.html, making it suitable for testing client-side routing. CORS can be enabled with a single flag for cross-origin API testing. HTTPS is supported through SSL certificate and key files for testing secure connections locally.

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)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community