From 65898987a65512285e74cbdd47b4848493a32800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorian=20Pu=C5=82a?= Date: Fri, 23 Feb 2024 21:29:37 -0500 Subject: [PATCH] Initial documentation of crate. --- README.md | 24 ++++++++++++++++++++---- src/main.rs | 6 ++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 70f9995..7657602 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # mirror-server -A simple server for mirroring HTTP requests for testing. +A simple server for mirroring HTTP requests for testing. It is optimized for +working with REST API JSON calls, and catching headers. [![Build Status](https://ci.birch-tree.net/api/badges/dorian/mirror-server/status.svg)](https://ci.birch-tree.net/dorian/mirror-server) @@ -14,9 +15,14 @@ A simple server for mirroring HTTP requests for testing. * Install cargo-deb: `cargo install cargo-deb` * Create the DEB package: `cargo deb` * Faster builds using [cargo-watch](https://watchexec.github.io/#cargo-watch): `cargo watch -x run` +* Installing the binary locally from source: `cargo install --path .` ## Install +`mirror-server` is installable either by a local Cargo install or a Debian +package. Additionally `mirror-server` can be run as a Docker container using +the latest (or tagged) release. + ### Docker Image Run via Docker using: @@ -38,7 +44,17 @@ sudo dpkg -i "mirror-server-${VERSION}_amd64.deb" Afterward you can run using `mirror-server` -## TODO +## Usage -* [ ] Add documentation to the API. -* [ ] Publish crate on . +```bash +> mirror-server --help +A simple server for mirror HTTP requests for testing. + +Usage: mirror-server [OPTIONS] + +Options: + -p, --port Port to run on [default: 8080] + -i, --ips Listen to IP mask [default: 0.0.0.0] + -h, --help Print help + -V, --version Print version +``` diff --git a/src/main.rs b/src/main.rs index 95c8ff1..ced23d1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,9 @@ +#![warn(missing_docs)] + +#![doc = include_str!("../README.md")] +/// ## Usage +/// + use axum::{ extract::{Host, Json, OriginalUri}, http::{header::HeaderMap, Method},