Skip to main content

Crate axum

Crate axum 

Source
Expand description

This is a pretty straightforward TODO app using the Axum web framework. You can add TODOs to your list but only if they meet certain criteria.

To run it:

cargo run

Add a TODO (HTTP 202):

curl -w "%{http_code}" -XPOST -H "content-type: application/json" \
  http://localhost:8080/todos -d '{"kind":"work","text":"Learn more Rust"}'

Fetch the current TODOs:

curl http://localhost:8080/todos

Add another TODO (HTTP 400):

curl -w "%{http_code}" -XPOST -H "content-type: application/json" \
  http://localhost:8080/todos -d '{"kind":"home","text":"Learn more Rust"}'

Structsยง

AppContext ๐Ÿ”’
PolicyDecider ๐Ÿ”’
Todo ๐Ÿ”’

Enumsยง

TodoKind ๐Ÿ”’
TodosError ๐Ÿ”’

Constantsยง

HOME_TODO_POLICY ๐Ÿ”’
WORK_TODO_POLICY ๐Ÿ”’

Functionsยง

add_todo ๐Ÿ”’
list_todos ๐Ÿ”’
main ๐Ÿ”’