|
1 рік тому | |
---|---|---|
source | 1 рік тому | |
.gitignore | 1 рік тому | |
Cargo.lock | 1 рік тому | |
Cargo.toml | 1 рік тому | |
LICENSE | 1 рік тому | |
README.md | 1 рік тому | |
Rocket Example.toml | 1 рік тому | |
rust-toolchain | 1 рік тому | |
rustfmt.toml | 1 рік тому |
Simple Rust Pastebin example as explained in the Rocket Guide.
Copy Rocket Example.toml
over to Rocket.toml
and generate a secret key and TLS certificates.
cp 'Rocket Example.toml' 'Rocket.toml'
Generate a secret key for Rocket.toml
.
openssl rand -base64 32
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.
Assuming you have the server setup at localhost:8000
and are using self-signed certificates.
curl --insecure https://localhost:8000
echo "New paste\!" | curl --insecure -X POST --data-binary @- https://localhost:8000
curl --insecure https://localhost:8000/list
curl --insecure https://localhost:8000/<id>
curl --insecure -X DELETE https://localhost:8000/<id>
Open-sourced under the Unlicense.