A minimal Rust Rocket API with MongoDB, registration/login, Argon2 password hashing, and JWT auth.
- Create
.env(see.env.example). - Run the server.
MONGO_URIe.g.mongodb://localhost:27017MONGO_DBdefaultmyappJWT_SECRETany random stringJWT_ISSUERdefaultmyapp
GET /healthhealth checkPOST /api/auth/register{ email, password }POST /api/auth/login{ email, password } -> { token }GET /api/auth/mewithAuthorization: Bearer <token>
- Debug:
cargo run
- Uses Argon2 for password hashing.
- Issues? Check Rocket and Mongo versions.