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.