Simple Rust Pastebin example as explained in the Rocket Guide. https://rocket.rs/v0.4/guide/pastebin/
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Este repositório está arquivado. Pode ver ficheiros e cloná-lo, mas não pode fazer envios ou lançar questões ou pedidos de integração.
Bauke baa0f84433
Move to self-hosted Gitea, update dependencies and clean up code.
há 1 ano
source Move to self-hosted Gitea, update dependencies and clean up code. há 1 ano
.gitignore Move to self-hosted Gitea, update dependencies and clean up code. há 1 ano
Cargo.lock Move to self-hosted Gitea, update dependencies and clean up code. há 1 ano
Cargo.toml Move to self-hosted Gitea, update dependencies and clean up code. há 1 ano
LICENSE Move to self-hosted Gitea, update dependencies and clean up code. há 1 ano
README.md Move to self-hosted Gitea, update dependencies and clean up code. há 1 ano
Rocket Example.toml Move to self-hosted Gitea, update dependencies and clean up code. há 1 ano
rust-toolchain Move to self-hosted Gitea, update dependencies and clean up code. há 1 ano
rustfmt.toml Move to self-hosted Gitea, update dependencies and clean up code. há 1 ano

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.