Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manosbatsis/axum-iban
A simple Rust Axum REST service to validate IBANs and get information about them.
https://github.com/manosbatsis/axum-iban
Last synced: about 2 months ago
JSON representation
A simple Rust Axum REST service to validate IBANs and get information about them.
- Host: GitHub
- URL: https://github.com/manosbatsis/axum-iban
- Owner: manosbatsis
- License: agpl-3.0
- Created: 2024-03-15T09:11:35.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-03-18T09:12:13.000Z (9 months ago)
- Last Synced: 2024-03-18T15:26:51.764Z (9 months ago)
- Language: Rust
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
axum-iban
[![CI](https://github.com/manosbatsis/axum-iban/actions/workflows/ci.yml/badge.svg)](https://github.com/manosbatsis/axum-iban/actions/workflows/ci.yml)
A simple REST API to validate [IBANs](https://en.wikipedia.org/wiki/International_Bank_Account_Number) and get information about them. Uses
[axum](https://github.com/tokio-rs/axum) and [iban_validate](https://github.com/ThomasdenH/iban_validate).
Tests use [axum-test](https://github.com/JosephLenton/axum-test).Table of Contents
* [Build](#build)
* [Basics](#basics)
* [Binary](#binary)
* [Run](#run)
* [Start Server with Cargo](#start-server-with-cargo)
* [Start Server with Docker](#start-server-with-docker)
* [Test](#test)
* [OpenAPI Documentation](#openapi-documentation)## Build
### Basics
Assuming you have Rust installed, checkout the repo, bavigate to the project's root folder and run:```shell
cargo build
```
Run tests:```shell
cargo test
```### Binary
Test the binary:
```shell
target/release/axum-iban -h
```which should display:
```shell
Axum IBAN REST APIUsage: axum-iban [OPTIONS]
Options:
--host Optional host IP to listen to (for example "0.0.0.0")
-l, --log Log level to use [possible values: trace, debug, info, warn, error]
-p, --port Optional port number to use (default is 3000)
-v, --version Print version info and exit
-h, --help Print help (see more with '--help')
```## Run
### Start Server with Cargo
Run server locally:
```shell
cargo run --release
```Specify log level:
```shell
cargo run --release -- --log error```
Log level from env:
```shell
RUST_LOG=debug cargo run --release
```### Start Server with Docker
Build Docker image and run container:
```shell
./run.sh
```## Test
Start the server first and then in another terminal (tab):
```shell
./test-routes.sh
```Or manually:
```shell
curl -s http://127.0.0.1:3000/info/version | jq .curl -s http://127.0.0.1:3000/info/healthcheck | jq .
curl -s http://127.0.0.1:3000/iban/DE44500105175407324931 | jq .
```### OpenAPI Documentation
Uses [utoipa](https://github.com/juhaku/utoipa) to generate OpenAPI documentation and UIs.
Swagger UI is available at `/doc`, Redoc at `/redoc`, and RapiDoc at `/rapidoc`.
The raw JSON can be seen from `/api-docs/openapi.json`.