mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Move examples to separate workspace (#978)
* Move examples to separate workspace * update commands to run examples * remove debug
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[workspace]
|
||||
members = ["*"]
|
||||
exclude = ["target"]
|
||||
@@ -3,7 +3,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-async-graphql
|
||||
//! cd examples && cargo run -p example-async-graphql
|
||||
//! ```
|
||||
|
||||
mod starwars;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-chat
|
||||
//! cd examples && cargo run -p example-chat
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-consume-body-in-extractor-or-middleware
|
||||
//! cd examples && cargo run -p example-consume-body-in-extractor-or-middleware
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-cors
|
||||
//! cd examples && cargo run -p example-cors
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-customize-extractor-error
|
||||
//! cd examples && cargo run -p example-customize-extractor-error
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-customize-path-rejection
|
||||
//! cd examples && cargo run -p example-customize-path-rejection
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-error-handling-and-dependency-injection
|
||||
//! cd examples && cargo run -p example-error-handling-and-dependency-injection
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-form
|
||||
//! cd examples && cargo run -p example-form
|
||||
//! ```
|
||||
|
||||
use axum::{extract::Form, response::Html, routing::get, Router};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-global-404-handler
|
||||
//! cd examples && cargo run -p example-global-404-handler
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-graceful-shutdown
|
||||
//! cd examples && cargo run -p example-graceful-shutdown
|
||||
//! kill or ctrl-c
|
||||
//! ```
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-hello-world
|
||||
//! cd examples && cargo run -p example-hello-world
|
||||
//! ```
|
||||
|
||||
use axum::{response::Html, routing::get, Router};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! Run with:
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-key-value-store
|
||||
//! cd examples && cargo run -p example-key-value-store
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-low-level-rustls
|
||||
//! cd examples && cargo run -p example-low-level-rustls
|
||||
//! ```
|
||||
|
||||
use axum::{extract::ConnectInfo, routing::get, Router};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-multipart-form
|
||||
//! cd examples && cargo run -p example-multipart-form
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-print-request-response
|
||||
//! cd examples && cargo run -p example-print-request-response
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-prometheus-metrics
|
||||
//! cd examples && cargo run -p example-prometheus-metrics
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-query-params-with-empty-strings
|
||||
//! cd examples && cargo run -p example-query-params-with-empty-strings
|
||||
//! ```
|
||||
|
||||
use axum::{extract::Query, routing::get, Router};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-readme
|
||||
//! cd examples && cargo run -p example-readme
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-reverse-proxy
|
||||
//! cd examples && cargo run -p example-reverse-proxy
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-routes-and-handlers-close-together
|
||||
//! cd examples && cargo run -p example-routes-and-handlers-close-together
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-sessions
|
||||
//! cd examples && cargo run -p example-sessions
|
||||
//! ```
|
||||
|
||||
use async_session::{MemoryStore, Session, SessionStore as _};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-sqlx-postgres
|
||||
//! cd examples && cargo run -p example-sqlx-postgres
|
||||
//! ```
|
||||
//!
|
||||
//! Test with curl:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-sse
|
||||
//! cd examples && cargo run -p example-sse
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-static-file-server
|
||||
//! cd examples && cargo run -p example-static-file-server
|
||||
//! ```
|
||||
|
||||
use axum::{http::StatusCode, routing::get_service, Router};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-stream-to-file
|
||||
//! cd examples && cargo run -p example-stream-to-file
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-templates
|
||||
//! cd examples && cargo run -p example-templates
|
||||
//! ```
|
||||
|
||||
use askama::Template;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-tls-rustls
|
||||
//! cd examples && cargo run -p example-tls-rustls
|
||||
//! ```
|
||||
|
||||
use axum::{routing::get, Router};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-todos
|
||||
//! cd examples && cargo run -p example-todos
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-tokio-postgres
|
||||
//! cd examples && cargo run -p example-tokio-postgres
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-tracing-aka-logging
|
||||
//! cd examples && cargo run -p example-tracing-aka-logging
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-unix-domain-socket
|
||||
//! cd examples && cargo run -p example-unix-domain-socket
|
||||
//! ```
|
||||
|
||||
#[cfg(unix)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-validator
|
||||
//! cd examples && cargo run -p example-validator
|
||||
//!
|
||||
//! curl '127.0.0.1:3000?name='
|
||||
//! -> Input validation error: [name: Can not be empty]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-versioning
|
||||
//! cd examples && cargo run -p example-versioning
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! Run with
|
||||
//!
|
||||
//! ```not_rust
|
||||
//! cargo run -p example-websockets
|
||||
//! cd examples && cargo run -p example-websockets
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
|
||||
Reference in New Issue
Block a user