import { Callout } from "nextra/components";

# Server

The server provides the `cup serve` command.

## Basic usage

```ansi
$ cup serve
[36;1m INFO [0mStarting server, please wait...
[36;1m INFO [0m✨ Checked 8 images in 8862ms
[36;1m INFO [0mReady to start!
[94;1m HTTP [0m[32mGET[0m / [32m200[0m in 0ms
[94;1m HTTP [0m[32mGET[0m /assets/index.js [32m200[0m in 3ms
[94;1m HTTP [0m[32mGET[0m /assets/index.css [32m200[0m in 0ms
[94;1m HTTP [0m[32mGET[0m /api/v3/json [32m200[0m in 0ms
```

This will launch the server on port `8000`. To access it, visit `http://<YOUR_IP>:8000` (replace `<YOUR_IP>` with the IP address of the machine running Cup.)

<Callout>
The URL `http://<YOUR_IP>:8000/api/v3/json` is also available for usage with integrations.
</Callout>

## Use a different port

Pass the `-p` argument with the port you want to use

```ansi
$ cup serve -p 9000
[36;1m INFO [0mStarting server, please wait...
[36;1m INFO [0m✨ Checked 8 images in 8862ms
[36;1m INFO [0mReady to start!
[94;1m HTTP [0m[32mGET[0m / [32m200[0m in 0ms
[94;1m HTTP [0m[32mGET[0m /assets/index.js [32m200[0m in 3ms
[94;1m HTTP [0m[32mGET[0m /assets/index.css [32m200[0m in 0ms
[94;1m HTTP [0m[32mGET[0m /api/v3/json [32m200[0m in 0ms
```

## Usage with Docker

If you're using the Docker image, just replace all occurences of `cup` in the examples with `docker run -tv /var/run/docker.sock:/var/run/docker.sock -p <PORT>:<PORT> ghcr.io/sergi0g/cup`, where `<PORT>` is the port Cup will be using.

For example, this:

```bash
$ cup serve -p 9000
```

becomes:

```bash
$ docker run -tv /var/run/docker.sock:/var/run/docker.sock -p 9000:9000 ghcr.io/sergi0g/cup serve -p 9000
```
