# pw endpoints serve

> Source: https://parallelworks.com/docs/cli/pw/endpoints/serve

## pw endpoints serve

Serve a static site directory as an endpoint

### Synopsis

Serve a built single-page-app directory (e.g. a Vite "dist") through an
endpoint. The CLI runs a static file server with SPA history fallback on a
local port and forwards it — no separate web server needed.

Use a subdomain (the default) so the app is served at the domain root and a
standard base:'/' build works unchanged.

```
pw endpoints serve DIR [flags]
```

### Examples

```
  # Serve a built SPA
  pw endpoints serve ./dist
  
  # Named and opened in the browser
  pw endpoints serve --name my_app --open ./dist
```

### Options

```
      --description string   Session description (defaults to "Endpoint on <hostname>")
  -h, --help                 help for serve
      --keep                 Keep the endpoint session on exit instead of deleting it
  -n, --name string          Name for the endpoint session (defaults to a server-generated name)
      --no-subdomain         Skip subdomain assignment and use the path-based session URL
      --open                 Open the endpoint URL in the browser
  -o, --output string        Output format (interactive, text); interactive shows a live dashboard and downgrades to text when stdout is not a terminal (default "interactive")
      --slug string          Session base-path slug (default "/")
      --strip-path           Strip the session URL prefix before forwarding to your app (use only if your app serves at the root path and can't be configured with a base path; by default the full path is forwarded so set your app's base path to the endpoint URL)
  -s, --subdomain string     Serve at this subdomain: a label (my-app) or the full host under the platform sessions domain (my-app.<sessions domain>); a random subdomain is used by default when the platform supports them
```

### Options inherited from parent commands

```
      --context string         The context to use. Overrides PW_CONTEXT environment variable and current context from config.
      --platform-host string   The Parallel Works ACTIVATE platform host to use. Will override any other platform host settings.
  -v, --verbose                Enable verbose logging
```

### SEE ALSO

* [pw endpoints](/docs/cli/pw/endpoints)	 - Create and serve self-registering endpoint sessions
