# 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 |