Skip to content

Commit cf7a12d

Browse files
chore(release): initial commit
1 parent 517c615 commit cf7a12d

File tree

2 files changed

+96
-9
lines changed

2 files changed

+96
-9
lines changed

Cargo.toml

+10-9
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
name = "echo-rs"
44
version = "0.1.0"
5+
description = "A simple HTTP echo server"
6+
license = "AGPL-3.0-or-later"
57
edition = "2021"
68
authors = ["Mark S. <[email protected]>"]
7-
license = "AGPL-3.0-or-later"
89

10+
readme = "README.md"
11+
homepage = "https://github.com/the-wondersmith/echo-rs"
12+
repository = "https://github.com/the-wondersmith/echo-rs"
13+
# documentation = "https://docs.rs/echo-rs/latest/echo_rs/"
14+
15+
keywords = ["kubernetes", "demo", "axum", "echo"]
16+
categories = ["web-programming::http-server", "development-tools::testing"]
917

10-
description = """
11-
A simple HTTP echo server
12-
"""
1318

1419

1520
[profile.dev]
@@ -33,16 +38,12 @@ incremental = true
3338

3439
log = "^0.4"
3540
anyhow = "^1"
36-
futures = "*"
37-
itertools = "*"
3841
tracing = "^0.1"
3942
metrics = "^0.21"
4043
serde_json = "^1"
41-
lazy_static = "^1"
42-
pretty_env_logger = "^0.5"
4344
metrics-exporter-prometheus = "^0.12"
45+
serde = { version = "^1", features = ["derive"]}
4446
tokio = { version = "^1.25", features = ["full"] }
4547
tracing-subscriber = { version = "^0.3", features = ["env-filter"] }
4648
clap = { version = "^4.3", features = ["env", "derive", "default"] }
4749
axum = { version = "^0.6", features = ["http2", "macros", "headers", "tracing"] }
48-
serde = { version = "^1", features = ["rc", "std", "alloc", "derive", "serde_derive"]}

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# echo-rs
2+
3+
[![crate](https://img.shields.io/crates/v/echo-rs.svg)](https://crates.io/crates/echo-rs)
4+
[![documentation](https://docs.rs/echo-rs/badge.svg)](https://docs.rs/echo-rs)
5+
<!-- [![tests](https://github.com/the-wondersmith/echo-rs/actions/workflows/tests.yml/badge.svg)](https://github.com/the-wondersmith/echo-rs/actions) -->
6+
<!-- [![coverage](https://coveralls.io/repos/github/the-wondersmith/echo-rs/badge.svg?branch=main)](https://coveralls.io/github/the-wondersmith/echo-rs?branch=main) -->
7+
8+
`echo-rs` provides a dead-simple HTTP echo server - i.e. it simply
9+
parrots back any request it receives in a developer-friendly JSON-serialized
10+
format.
11+
12+
It aims to provide a simple and convenient utility to assist in designing
13+
new applications, developing / testing API clients, or as a "dummy" workload
14+
for use in scaffolding new Kubernetes / cloud-native services.
15+
16+
### License
17+
18+
[`AGPL-3.0-or-later`](https://spdx.org/licenses/AGPL-3.0-or-later.html)
19+
20+
21+
### Features
22+
`echo-rs` provides:
23+
24+
- A simple HTTP echo server, returning a JSON-serialized representation of any request made to it
25+
- Prometheus metrics (helpful when using `echo-rs` as a dummy workload when designing new Kubernetes services)
26+
27+
28+
### Basic Usage
29+
30+
Run the server locally -
31+
32+
```bash
33+
docker run -it -p 8080:8080 --rm docker.io/thewondersmith/echo-rs:latest --metrics=false --log-level=debug
34+
```
35+
36+
Then make a request to it with any HTTP client -
37+
38+
```bash
39+
curl -X POST \
40+
"http://localhost:8080/some/super-cool/endpoint?param1=some-param-value&param2=another-param-value" \
41+
-H 'Content-Type: application/json' \
42+
-H 'App-Specific-Header: app_specific_value' \
43+
-d '{"target": "echo-rs", "expected": "response", "some": ["more", "none", null], "nested": {"turtles": {"all": {"the": {"way": "down"}}}}}'
44+
```
45+
46+
`echo-rs` should return the JSON-serialized representation of the request -
47+
48+
```json
49+
{
50+
"method": "POST",
51+
"path": "/some/super-cool/endpoint",
52+
"headers": {
53+
"user-agent": "curl/7.87.0",
54+
"host": "localhost:8080",
55+
"accept": "*/*",
56+
"content-type": "application/json",
57+
"app-specific-header": "app_specific_value",
58+
"content-length": "135"
59+
},
60+
"params": {
61+
"param1": "some-param-value",
62+
"param2": "another-param-value"
63+
},
64+
"body": {
65+
"expected": "response",
66+
"nested": {
67+
"turtles": {
68+
"all": {
69+
"the": {
70+
"way": "down"
71+
}
72+
}
73+
}
74+
},
75+
"some": [
76+
"more",
77+
"none",
78+
null
79+
],
80+
"target": "echo-rs"
81+
}
82+
}
83+
```
84+
85+
### TODO:
86+
- Tests 😅

0 commit comments

Comments
 (0)