High-performance link shortener written in Rust
In addition to being easy to build from source, shorty is available as a Docker image on Docker Hubā .
DB_URL - a valid Redis URL, e.g. redis://localhost:1234TOKEN - your desired API token; only required if you're using the API (described below).Configure the server through environment variables or Rocket.toml; check this guideā for more information. shorty runs on port 8000 by default.
Use shorty's API to add/remove links.
Provide your TOKEN (described above) as a bearer token, so set the Authorization header to Bearer <token>. Example: curl -H "Authorization: Bearer token1234" http://localhost:8000/api/example/route
POST requests must all contain JSON payloads. x-www-form-urlencoded is not supported.
All responses are JSON, and follow this rough schema:
{
// False if something went wrong
"ok": true,
// Will be a string if something went wrong
"err": null,
"data": {
// Response data here...
}
}
POST /api/link - create or update a named linkOptions:
url (string, required) - The URL the redirect to.name (string, optional) - The link's name. Leave blank to randomly generate a 10-character ID.public (bool, optional) - Whether or not to display this link on the public links page; coming soonā¹ļø Note:
/ is a special value for <name> that creates a redirect for the root URL.
DELETE /api/link/<name> - delete a named linkexample: curl -X DELETE http://localhost:8000/api/link/gh
ā¹ļø Note:
Please URL encode the <name> parameter if necessary; / will become %2F
Content type
Image
Digest
sha256:6d7059f1fā¦
Size
69.9 MB
Last updated
over 3 years ago
docker pull cjdenio/shorty