- Download project and unpack it or clone it using
git clone https://github.com/LempekPL/RustRedirect
with git - Open cmd/terminal
- Go inside project's folder using
cd <path to the folder>
- Run
cargo build --release
- The executable file should be located in /target/release/
- GET
/api/v1/redirect
- get list of redirects
Hearders: Authorization - string key
Response: JSON
Object{ success: bool, response: Array[Domain] | string }
Domain = {id: number, name: string, domain: string}
Example of successful response{ "success": true, "response": [ { "name":"example", "domain":"https://example.com", "owner": {"$oid": "62ef10543db77254ebbg48a3"} }, { "name":"lk", "domain":"https://lmpk.tk", "owner": {"$oid": "gbhs6fd4f8b413gffd1sef44"} } ] }
- POST
/api/v1/redirect/create?name=<name>&domain=<domain>
- create redirect
Params: name - string, domain - string
Hearders: name - string (name of token, not domain), token - string
Response: JSON
Object{ success: bool, response: string }
Example of successful responseExample of unsuccessful response{ "success": true, "response": "Created redirect to '<domain>' named '<name>'. Using token named: '<auth token name>'" }
{ "success": false, "response": "Could not create redirect." }