# serve

### Overview

`ng serve` builds the application and starts a web server.

### Options

`--aot` (default `true`)\
Build using Ahead of Time compilation.

`--base-href` \
Base URL for the application being built.&#x20;

`--browser-target` \
Target to serve.&#x20;

`--common-chunk` \
Use a separate bundle containing code used across multiple bundles.&#x20;

`--configuration` (alias `-c`) \
Specify the configuration to use.&#x20;

`--deploy-url` \
URL where files will be deployed.&#x20;

`--disable-host-check` \
Don't verify connected clients are part of allowed hosts.&#x20;

`--eval-source-map` \
Output in-file eval source maps.&#x20;

`--hmr` \
Enable hot module replacement.&#x20;

`--hmr-warning` \
Show a warning when the `--hmr` option is enabled.&#x20;

`--host` \
Host to listen on.&#x20;

`--live-reload` \
Whether to reload the page on change, using live-reload.&#x20;

`--open` (alias `-o`) \
Opens the URL in default browser.&#x20;

`--optimization` \
Enables optimization of the build output.&#x20;

`--poll` \
Enable and define the file watching poll time period in milliseconds.

`--port` \
Port to listen on.

`--prod` \
Flag to set configuration to "prod".

`--progress` \
Log progress to the console while building.

`--proxy-config` \
Proxy configuration file.

`--public-host` \
Specify the URL that the browser client will use.

`--serve-path` \
The path name where the app will be served.

`--serve-path-default-warning` \
Show a warning when deploy-url/base-href use unsupported serve path values.

`--source-map` \
Output source maps.

`--ssl` \
Serve using HTTPS.

`--ssl-cert` \
SSL certificate to use for serving HTTPS.

`--ssl-key` \
SSL key to use for serving HTTPS.

`--vendor-chunk` \
Use a separate bundle containing only vendor libraries.

`--vendor-source-map` \
Resolve vendor packages source maps.

`--watch` \
Rebuild on change.

### Example

Let’s make sure the app works in the browser.

```bash
ng serve -o
```

Passing the `-o` flag will automatically pull up a browser window with [*localhost:4200*](http://localhost:4200) serving your app.

![](https://3957251416-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMLx16lW7YbgTkut2nU%2F-LMpuBbLWQD4dgAuQygz%2F-LMpu7M9JWNpEr92pTNj%2Fng-serve-my-app.png?alt=media\&token=f85b406d-9659-418c-95f3-5cbc6b518178)
