|
1 | 1 | # Request Hole CLI
|
2 | 2 | [](https://pkg.go.dev/github.com/aaronvb/request_hole)
|
3 |
| -[](https://github.com/aaronvb/request_hole/actions/workflows/tests.yml) |
| 3 | +[](https://github.com/aaronvb/request_hole/actions/workflows/test_go.yml) |
| 4 | +[](https://github.com/aaronvb/request_hole/actions/workflows/test_js.yml) |
4 | 5 | [](https://github.com/aaronvb/request_hole/actions/workflows/builds.yml)
|
5 | 6 |
|
6 | 7 | `rh` is a CLI tool for creating an ephemeral endpoint for testing and inspecting requests from your application or webhook.
|
7 | 8 |
|
| 9 | +<img width="1136" alt="Request Hole CLI web ui" src="https://user-images.githubusercontent.com/100900/125158715-9b866500-e10e-11eb-9438-36d0f8325c60.png"> |
8 | 10 | <img width="788" alt="Request Hole CLI" src="https://user-images.githubusercontent.com/100900/120265767-63048900-c23c-11eb-9a20-079ab9822767.png">
|
9 | 11 |
|
10 | 12 |
|
@@ -48,10 +50,21 @@ Flags:
|
48 | 50 | --log string writes incoming requests to the specified log file (example: --log rh.log)
|
49 | 51 | -p, --port int sets the port for the endpoint (default 8080)
|
50 | 52 | -r, --response_code int sets the response code (default 200)
|
| 53 | + --web runs a web server to show incoming requests |
| 54 | + --web_port int sets the port for the web server (default 8081) |
51 | 55 |
|
52 | 56 | Use "rh [command] --help" for more information about a command.
|
53 | 57 | ```
|
| 58 | +## Using the Web UI |
| 59 | +### Create an HTTP endpoint |
| 60 | +``` |
| 61 | +$ rh http --web |
| 62 | +``` |
| 63 | +This option will open a web UI that will display the incoming requests. Incoming requests will render live in the browser when they are received. |
54 | 64 |
|
| 65 | +<img width="1136" alt="Request Hole CLI web ui" src="https://user-images.githubusercontent.com/100900/125158715-9b866500-e10e-11eb-9438-36d0f8325c60.png"> |
| 66 | + |
| 67 | +## Using the CLI |
55 | 68 | ### Creating an HTTP endpoint
|
56 | 69 | To create an http endpoint with default settings (port 8080, return status code 200):
|
57 | 70 | ```
|
@@ -79,3 +92,35 @@ Sometimes we need to expose `rh` to the internet to test applications or webhook
|
79 | 92 | $ ngrok http 3001
|
80 | 93 | $ rh http -p 3001
|
81 | 94 | ```
|
| 95 | + |
| 96 | +## Running Tests and Building |
| 97 | +It is recommended to run the JS build first so that the Go build can embed the latest web UI build. |
| 98 | + |
| 99 | +### CLI |
| 100 | +``` |
| 101 | +$ go test -v ./... |
| 102 | +$ go build |
| 103 | +``` |
| 104 | + |
| 105 | +### Web UI |
| 106 | +``` |
| 107 | +$ cd web; yarn test |
| 108 | +$ cd web; yarn build |
| 109 | +``` |
| 110 | +#### For Development |
| 111 | +``` |
| 112 | +$ cd web; yarn start |
| 113 | +``` |
| 114 | +Visit `localhost:3000` |
| 115 | + |
| 116 | +## Built With |
| 117 | +- Go https://golang.org/ |
| 118 | +- logparams https://github.com/aaronvb/logparams |
| 119 | +- logrequest https://github.com/aaronvb/logrequest |
| 120 | +- cobra https://github.com/spf13/cobra |
| 121 | +- gqlgen https://github.com/99designs/gqlgen (GraphQL/Websockets) |
| 122 | +- gorilla/mux https://github.com/gorilla/mux |
| 123 | +- Apollo https://github.com/apollographql/apollo-client (GraphQL frontend) |
| 124 | +- create-react-app https://github.com/facebook/create-react-app |
| 125 | +- Tailwind https://github.com/tailwindlabs/tailwindcss |
| 126 | +- React Testing Library https://github.com/testing-library/react-testing-library |
0 commit comments