paste microservice written in Go
start urlshort first, start ctrlshiftv after that and then do one of the following:
when json encoded:
curl --header "Content-Type: application/json" -d '{"content": "some paste"}' http://localhost:8080/
when plain text from stdin:
echo "this is paste content" | curl http://localhost:8080/ -d @-
when plain text in a file
curl http://localhost:8080/ -d @filetopaste.go
run with go run main.go
and in a different terminal send data to it
with curl:
curl --header "Content-Type: application/json" -d '{"content": "mypaste"}' http://localhost:8080/
which should yeild a response like below:
{"code":"297ZHGHMg","content":"mypaste","created_at":1597777998}
and then view the contents with:
curl http://localhost:8080/297ZHGHMg
which should return:
mypaste