A simple server in rust for use in our Android and iOS course.
Make sure you have rust and cargo installed.
Simply run cargo run
in the root of this project to run the server.
It currently binds to port 8080.
All endpoints return 404 when incorrect post ids and/or unhashed usernames are provided.
All endpoints return Post
objects:
{
"title": "String",
"body": "String",
"hashedPoster": "String",
"timestamp": "ISO 8601 timestamp",
"id": 0
}
Returns a list of posts. Optionally accepts a poster
query parameter and returns only posts with that poster hash.
Returns the post with the given id, if one exists.
Creates a new post.
Body:
{
"title": "String",
"body": "String",
"poster": "unhashed username"
}
Updates the post with post_id
, if one exists. The original poster username must be provided. Only the post body is editable.
Body:
{
"body": "String",
"poster": "Unhashed username"
}
Updates the post with post_id
, if one exists. The original poster username must be provided.
Body:
{
"poster": "Unhashed username"
}