Superball! is a simple utility to aid in testing of callback-based web services. It exposes these endpoints:
- GET
/
A simple message from the server - GET
/echo/<anything>
Echo back what you send in the url - GET
/bounce?url=<url-encoded-url>
Redirect to the specified url - GET
/session
Show the default session
Superball! can now be built using two different methods: using local Rust toolchains or using Docker. It can be deployed using Docker to containerize the compiled application. If you'd like to contribute to Superball! then please follow these steps:
- Fork the repo
- Code the things
- Log the things
- Writes tests for the things
- Run
cargo fmt
to make it pretty - Run
cargo test
and pass all the tests - Push it. Push it real good.
- Submit a PR
- ?????
- Contribution!
The Docker method to build uses Fletcher Nichol's excellent Docker containers for the Rust toolchain.
- Get Docker
- Open a terminal and
cd
to the Superball! root directory (where this README is located) - Create a container to act as a cargo data cache (so you don't have to download packages everytime you build!)
docker create -v /cargo --name cargo-cache tianon/true /bin/true
- To run tests or debug the code, you can use the container toolchain to run Superball! directly
docker run --rm -v $(pwd):/src --volumes-from cargo-cache fnichol/rust:nightly cargo run
- When you're ready to finalize and build, use the container to build Superball! (writes into your
target/release
directory)docker run --rm -v $(pwd):/src --volumes-from cargo-cache fnichol/rust:nightly cargo build --release
- Build the Superball! container
docker build --tag='superball:X.Y.Z' .
- Edit
docker-compose.yml
to point to the correct version of Superball! that you just built - Run Superball! from its container!
docker-compose up
- Rust
- Download and install rustup
- Follow instructions to set up the
stable
version of rust
- It should also build using the nightly rust
- Try it out with
rustup toolchain install nightly rustup run nightly cargo build
- Verify your installations
- Verson manager:
rustup -V
- Package manager:
cargo -V
- Compiler:
rustc -V
- Rust Formatter:
rustfmt
cargo install rustfmt
cargo fmt
To build do:
cargo build
To build and run do:
cargo run
To run unit tests do:
cargo test