api for managing an online forum
- handle DELETE requests
- secure user authentication
- Error handling
- make documentation and more descriptive readme for the api
The only dependencies are rust and cargo.
git clone [email protected]:penky776/osf_hackathon_1.git
# OR
git clone https://github.com/penky776/osf_hackathon_1.git
To start the server, cd into the directory and:
cargo run
POST /login
curl --location 'http://localhost:3000/login' \
--data-urlencode 'username=USERNAME' \
--data-urlencode 'password=PASSWORD' -v
POST /register
curl --location 'http://localhost:3000/register' \
--data-urlencode 'username=USERNAME' \
--data-urlencode 'password=PASSWORD' -v
DELETE /deleteuser
curl --location --request DELETE 'http://localhost:3000/deleteuser' \
--header 'Cookie: session_token=SESSION_TOKEN; username=USERNAME'
GET /get-csrf-token
curl --location 'http://localhost:3000/get-csrf-token' \
--header 'Cookie: session_token=SESSION_TOKEN; username=USERNAME'
POST /addpost
curl --location 'http://localhost:3000/addpost' \
--header 'Cookie: session_token=SESSION_TOKEN; username=USERNAME' \
--data-urlencode 'csrf_token=CSRF_TOKEN' \
--data-urlencode 'title=POST_TITLE' \
--data-urlencode 'body=POST_BODY'
POST /deletepost
curl --location 'http://localhost:3000/deletepost' \
--header 'Cookie: session_token=SESSION_TOKEN; username=USERNAME' \
--data-urlencode 'id=POST_ID' \
--data-urlencode 'csrf_token=CSRF_TOKEN'
POST /addcomment
curl --location 'http://localhost:3000/addcomment' \
--header 'Cookie: session_token=SESSION_TOKEN; username=USERNAME' \
--data-urlencode 'body=COMMENT_BODY' \
--data-urlencode 'post_id=POST_ID' \
--data-urlencode 'csrf_token=CSRF_TOKEN'
POST /deletecomment
curl --location 'http://localhost:3000/deletecomment' \
--header 'Cookie: session_token=SESSION_TOKEN; username=USERNAME' \
--data-urlencode 'id=COMMENT_ID' \
--data-urlencode 'csrf_token=CSRF_TOKEN'