The TQ Code Generator Core API is a Rust API built with the warp web framework and the tq-code-generator-core crate. It generates random codes of a specified length.
Before running the API, make sure you have the following installed:
- Rust (stable)
- Cargo
To install the API, follow these steps:
- Clone this repository:
git clone https://github.com/toolquarry/tq-code-generator-core-api.git
- Navigate to the project directory:
cd tq-code-generator-core-api
- Build the project:
cargo build --release
To use the API, run the following command from the project directory:
cargo run --release
This will start the server on localhost:8000
.
The API has one endpoint:
GET /generate/{length}
- generates a random code of the specified length and returns it as a JSON response.
To generate a code of length 8, send a GET request to http://localhost:8000/generate/8
.
curl http://localhost:8000/generate/8
Response
{
"code": "sdfKjMnE"
}
The API uses the rustic_logger crate for logging. Logs are written to app-log.log
in the project directory.
This project is licensed under the MIT License - see the LICENSE file for details.