{"id":18559033,"url":"https://github.com/linux-china/axum-demo","last_synced_at":"2025-07-10T12:17:39.746Z","repository":{"id":62075766,"uuid":"391201738","full_name":"linux-china/axum-demo","owner":"linux-china","description":"Axum demo","archived":false,"fork":false,"pushed_at":"2025-01-05T03:44:12.000Z","size":38,"stargazers_count":16,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T02:51:07.344Z","etag":null,"topics":["axum","rust","tokio"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linux-china.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-30T22:38:20.000Z","updated_at":"2025-03-29T21:12:43.000Z","dependencies_parsed_at":"2024-06-25T05:26:00.363Z","dependency_job_id":null,"html_url":"https://github.com/linux-china/axum-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Faxum-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Faxum-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Faxum-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Faxum-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linux-china","download_url":"https://codeload.github.com/linux-china/axum-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144155,"owners_count":21054876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axum","rust","tokio"],"created_at":"2024-11-06T21:41:53.149Z","updated_at":"2025-04-10T02:30:36.225Z","avatar_url":"https://github.com/linux-china.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Axum demo\n============\n\nAxum: ergonomic and modular web framework built with Tokio, Tower, and Hyper.\n\n* Route requests to handlers with a macro free API.\n* Declaratively parse requests using extractors.\n* Simple and predictable error handling model.\n* Generate responses with minimal boilerplate.\n* Take full advantage of the tower and tower-http ecosystem of middleware, services, and utilities.\n\nHyper: A fast and correct HTTP implementation for Rust.\n\n* HTTP/1 and HTTP/2\n* Asynchronous design\n* Leading in performance\n* Tested and correct\n* Extensive production use\n* Client and Server APIs\n\ntower-http: a collection of HTTP specific middleware and utilities built with Tower's Service trait.\n\n* Trace: Easily add high level tracing/logging to your application. Supports determining success or failure via status codes as well as gRPC specific headers. Has great defaults but also supports deep customization.\n* Compression and Decompression: Automatically compress or decompress response bodies. This goes really well with serving static files using ServeDir.\n* FollowRedirect: Automatically follow redirection responses.\n\nhttp: a general purpose library of common HTTP types, for examples `http::{Request, Response, StatusCode}` \n\n# Vocabulary\n\n* Handler: an async function that accepts zero or more “extractors” as arguments and returns something that can be converted into a response.\n* Routing: between handlers and request paths\n* Extractor: a type that implements FromRequest. Extractors are how you pick apart the incoming request to get the parts your handler needs.\n* Building responses: anything that implements IntoResponse can be returned from a handler\n* Middleware: used to decorate the application, providing additional functionality\n\n# Demo cases\n\n* static assets handle\n* index page\n* form submit: login\n* json submit: REST API\n* json output: struct and json!() macro\n* query:  `/search?q=java`\n* Path variables/params `/user/:id`\n* 404 handler:  Separate net(\"/\") and handler_404() \n\n# Docker support\nRefer from  [Packaging a Rust web service using Docker](https://blog.logrocket.com/packaging-a-rust-web-service-using-docker/) \n\n```bash\ndocker build -t axum-demo .\ndocker run -p 3000:3000 axum-demo\n```\n\nOr you can refer https://kerkour.com/blog/rust-small-docker-image/\n\n# Axum Extension\n\nCommunity Projects: https://github.com/tokio-rs/axum/blob/main/ECOSYSTEM.md\n\n* axum-htmx:  https://github.com/robertwayne/axum-htmx\n\n# References\n\n* Axum home: https://github.com/tokio-rs/axum\n* Axum examples: https://github.com/tokio-rs/axum/tree/main/examples\n* axum-prometheus: Prometheus metrics middleware for Axum https://github.com/ptrskay3/axum-prometheus\n* Replacing nginx with axum: https://felix-knorr.net/posts/2024-10-13-replacing-nginx-with-axum.html\n* Rust Web Programming - Third Edition: https://learning.oreilly.com/library/view/-/9781835887769/\n* Getting Started with Axum - Rust's Most Popular Web Framework: https://www.shuttle.rs/blog/2023/12/06/using-axum-rust\n* Introduction to Axum: https://www.youtube.com/playlist?list=PLrmY5pVcnuE-_CP7XZ_44HN-mDrLQV4nS\n* Announcing Axum: https://tokio.rs/blog/2021-07-announcing-axum\n* Using Rust with Axum for error handling: https://blog.logrocket.com/rust-axum-error-handling/\n* How to use “Type safe routing” of axum: https://medium.com/mixi-developers/how-to-use-type-safe-routing-of-axum-c06c1b1b1ab\n* How to deploy a Rust Web Server to Heroku using Axum, Docker, and Github Actions: https://fbzga.medium.com/how-to-deploy-a-rust-web-server-to-heroku-using-axum-docker-and-github-actions-6cddb442ea7e\n* Deploy a Rust web server to Heroku with axum, Tokio, and GitHub Actions: https://blog.logrocket.com/deploy-rust-web-server-heroku-axum-tokio-github-actions/\n* Learning by doing: An HTTP API with Rust: https://blog.frankel.ch/http-api-rust/\n* Building a Proxy Server in Rust with Axum: https://medium.com/dev-genius/building-a-proxy-server-in-rust-with-axum-4d1e0215a6b0\n* Writing a Rest HTTP Service with Axum: https://docs.shuttle.rs/tutorials/rest-http-service-with-axum\n* API Evolution in axum: https://www.youtube.com/watch?v=w1atdqNsA80\n* Bundle frontend into axum binary using include_dir: https://dev.to/konstantin/bundle-frontend-with-axum-build-using-includedir-g8i\n* Extracting Generic Substates in Axum: https://mhu.dev/posts/2024-07-02-axum-generic-substate/\n* Using Axum Framework To Create REST API: \n   - https://medium.com/intelliconnect-engineering/using-axum-framework-to-create-rest-api-part-1-7d434d2c5de4\n   - https://medium.com/intelliconnect-engineering/using-axum-framework-to-create-rest-api-part-ii-4eba129c196b\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Faxum-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinux-china%2Faxum-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Faxum-demo/lists"}