Simple asynchronous microservice using Rust ⇩
, Actix Web, and Docker ⇩
.
JWT auth middleware: https://github.com/hscii/jwt-middleware-crate
To run the service locally without using Docker, use the following command:
cargo run
By default, this will serve your application at http://127.0.0.1:8080/
You should get a pong
response from: http://127.0.0.1:8080/ping
To run this service in a Docker container, use the following commands:
docker build -t microservice-template .
docker run --rm -p 8080:8080 microservice-template
The BIND_ADDRESS
environment variable is already set in the Dockerfile to 0.0.0.0:8080
, so no additional configuration is needed for the container.
Use -e RUST_LOG=debug
to enable debug logging.
Replace the following:
8080:8080
with your desired port mappingmicroservice-template
with your service name
To run all tests in the /tests
directory:
cargo test