From 27f84bbe3b82b52dd3cdf46ec398164f72f76257 Mon Sep 17 00:00:00 2001 From: Gunwant Jain Date: Wed, 30 Dec 2020 04:37:30 +0530 Subject: [PATCH] add readme Needs a hosting guide too. Signed-off-by: Gunwant Jain --- readme | 36 ++++++++++++++++++++++++++++++++++++ src/main.rs | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 readme diff --git a/readme b/readme new file mode 100644 index 0000000..df2b5b9 --- /dev/null +++ b/readme @@ -0,0 +1,36 @@ + USAGE + ----- + + POST / + + accepts raw data in the body of the request and responds with a URL + of a page containing the body's content + + GET / + + retrieves the content for the paste with id `` + + GET /p/ + + retrieves the HTML page with syntax-highlighted content for the paste with id `` + + EXAMPLES + -------- + + Paste a file named 'file.txt' using cURL: + + curl -d@file.txt https://bin.wantguns.dev + + Paste from stdin using cURL: + + echo "Hello, world." | curl -d@- https://bin.wantguns.dev + + Add this to your .zshrc to implement a quicker usage. + + function paste() { + local file=${1:-/dev/stdin} + curl -d@${file} https://bin.wantguns.dev + } + + If the uploaded data binary is parsed as "text/*", then the paste will be syntax + highlighted diff --git a/src/main.rs b/src/main.rs index 11e0037..f8abb81 100644 --- a/src/main.rs +++ b/src/main.rs @@ -69,7 +69,7 @@ fn upload(paste: Data) -> Result { #[get("/")] fn index() -> &'static str { - "\ +" USAGE -----