Simple Rust Pastebin example as explained in the Rocket Guide. https://rocket.rs/v0.4/guide/pastebin/
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
このリポジトリはアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュや、課題・プルリクエストのオープンはできません。
Bauke baa0f84433
Move to self-hosted Gitea, update dependencies and clean up code.
1年前
source Move to self-hosted Gitea, update dependencies and clean up code. 1年前
.gitignore Move to self-hosted Gitea, update dependencies and clean up code. 1年前
Cargo.lock Move to self-hosted Gitea, update dependencies and clean up code. 1年前
Cargo.toml Move to self-hosted Gitea, update dependencies and clean up code. 1年前
LICENSE Move to self-hosted Gitea, update dependencies and clean up code. 1年前
README.md Move to self-hosted Gitea, update dependencies and clean up code. 1年前
Rocket Example.toml Move to self-hosted Gitea, update dependencies and clean up code. 1年前
rust-toolchain Move to self-hosted Gitea, update dependencies and clean up code. 1年前
rustfmt.toml Move to self-hosted Gitea, update dependencies and clean up code. 1年前

README.md

Pastebin

Simple Rust Pastebin example as explained in the Rocket Guide.

Rocket Configuration

Copy Rocket Example.toml over to Rocket.toml and generate a secret key and TLS certificates.

cp 'Rocket Example.toml' 'Rocket.toml'

Secret Key

Generate a secret key for Rocket.toml.

openssl rand -base64 32

TLS

Generate a self-signed certificate for development.

mkdir certs/ &&
yes "" | openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out certs/certs.pem -keyout certs/key.pem

Or remove the TLS feature from Rocket in Cargo.toml, if you don’t want HTTPS.

Usage

Assuming you have the server setup at localhost:8000 and are using self-signed certificates.

Index

curl --insecure https://localhost:8000

Create New Paste

echo "New paste\!" | curl --insecure -X POST --data-binary @- https://localhost:8000

List All Pastes

curl --insecure https://localhost:8000/list

Show Paste

curl --insecure https://localhost:8000/<id>

Delete Paste

curl --insecure -X DELETE https://localhost:8000/<id>

License

Open-sourced under the Unlicense.