bin.cr
bin.cr
A simple pastebin
clone written in Crystal.
Installation
git clone https://github.com/7wf/bin.cr && cd bin.cr
shards
crystal run src/bin.cr
Usage
A web server will listen at port 8080.
Homepage
You can GET /
and GET /help.txt
to view the help text.
The help text can be changed by modifying the paste help.txt
directly.
Example
$ curl http://127.0.0.1:8080
See https://github.com/7wf/bin.cr
If you'd like to modify the help text, you can edit
pastes/help.txt
.
Creating a paste
To create pastes, you can use POST /pastes
with body contents.
The server should reply with the ID of the generated paste.
Example
$ echo "Hello, world." | http -b POST http://127.0.0.1:8080/pastes
n5fl
$ cat file.txt | http -b POST http://127.0.0.1:8080/pastes
o2fK
Viewing a paste
To view a paste, you need to have the paste ID.
With the paste ID you can GET /{paste id}
and the server will reply with paste contents.
Example
$ http GET http://127.0.0.1:8080/n5fl
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 14
Hello, world.
Contributing
- Fork it (https://github.com/7wf/bin.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- 7wf - creator and maintainer
Repository
bin.cr
Owner
Statistic
- 0
- 0
- 0
- 0
- 2
- almost 4 years ago
- April 16, 2020
License
MIT License
Links
Synced at
Sun, 12 May 2024 15:01:27 GMT
Languages