Tree


.formatter.exscommits | blame
.gitignorecommits | blame
BUILDcommits | blame
CHANGELOG.mdcommits | blame
Containerfilecommits | blame
LICENSEcommits | blame
Makefilecommits | blame
README.mdcommits | blame
cliff.tomlcommits | blame
config/
flake.lockcommits | blame
flake.nixcommits | blame
hack/
lib/
mix.exscommits | blame
mix.lockcommits | blame
prek.tomlcommits | blame

README.md

# shirts

A URL shortener. Links are stored in a SQLite database and served under a configurable base URL.

## Building

```sh
mix deps.get
mix release
```

## Usage

### Create a short link

```sh
curl -X POST http://localhost:8721/curtail \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/very/long/path"}'
```

Optionally provide a custom code:

```sh
curl -X POST http://localhost:8721/curtail \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/very/long/path", "code": "my-code"}'
```

### Follow a short link

```
GET /s/<code>
```

## Configuration

| Variable   | Description                          |
|------------|--------------------------------------|
| `PORT`     | Port to listen on (default: `8721`)  |
| `HOST`     | Host to bind to (default: `127.0.0.1`) |
| `BASE_URL` | Base URL used when generating links  |
| `AUTH_TOKEN` | Bearer token for the create endpoint |
| `DB_PATH`  | Path to the SQLite database file     |