Skip to content

dcastelltort/rocket-pastebin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pastebin tutorial

This is my attempt at implementing the "what's next?" section of the pastebin tutorial from rocket. Don't use this as a reference, and feedback or alternative implementations are welcomed :)

TODO:

  • add a web form to the index where users can manually input new pastes. Accept the form at POST /. Use format and/or rank to specify which of the two POST / routes should be called.
  • Add a new route, GET // that syntax highlights the paste with ID for language . If is not a known language, do no highlighting. Possibly validate with FromParam.
  • persist in a DB instead of file (diesel+postgres)

WIP:

Done:

  • make cleanup thread safe (currently unwrapping all over the place)
  • Dispatch a thread before launching Rocket in main that periodically cleans up idling old pastes in upload/.
  • add config file
  • Use the local module to write unit tests for your pastebin.
  • Add a PUT / route that allows a user with the key for to replace the existing paste, if any.
  • Support deletion of pastes by adding a new DELETE / route. Use PasteID to validate .
  • Limit the upload to a maximum size. If the upload exceeds that size, return a 206 partial status code. Otherwise, return a 201 created status code.
  • Set the Content-Type of the return value in upload and retrieve to text/plain.
  • Return a unique “key” after each upload and require that the key is present and matches when doing deletion. Use one of Rocket’s core traits to do the key validation.

About

my attempt at implementing the "what's next?" section of the pastebin tutorial from rocket

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages