@@ -62,31 +62,33 @@ Replace `<DB_USER>`, `<DB_NAME>`, and `<DB_PORT>` with the values from your `.en
6262
6363The following endpoints are available in the API:
6464
65- - ** POST /api/user ** : Register a new user.
65+ - ** POST /api/auth/register ** : Register a new user.
6666- ** POST /api/auth/login** : Authenticate a user and return a JWT.
67- - ** GET /api/user/:id** : Get a user (requires a valid JWT).
68- - ** PATCH /api/user/:id** : Update a user (requires a valid JWT).
69- - ** DELETE /api/user/:id** : Delete a user (requires a valid JWT).
70- - ** GET /api/product** : Get all products.
71- - ** GET /api/product/:id** : Get a product.
72- - ** POST /api/product** : Create a new product (requires a valid JWT).
73- - ** DELETE /api/product/:id** : Delete a product (requires a valid JWT).
67+ - ** POST /api/auth/logout** : Logout a user and revoke their JWT.
68+ - ** POST /api/auth/refresh-token** : Refreshes a user token and returns a JWT.
69+ - ** GET /api/users/:id** : Get a user (requires a valid JWT).
70+ - ** PATCH /api/users/:id** : Update a user (requires a valid JWT).
71+ - ** DELETE /api/users/:id** : Delete a user (requires a valid JWT).
72+ - ** GET /api/products** : Get all products.
73+ - ** GET /api/products/:id** : Get a product.
74+ - ** POST /api/products** : Create a new product (requires a valid JWT).
75+ - ** DELETE /api/products/:id** : Delete a product (requires a valid JWT).
7476
7577# # Example Usage
7678
77791. Register a new user:
7880 ` ` ` bash
79- curl -X POST http://localhost:3000/api/user -d ' {"username":"testuser", "password":"testpassword", "email":"test@example.com"}' -H " Content-Type: application/json"
81+ curl -X POST http://localhost:3000/api/auth/register -d ' {"username":"testuser", "password":"testpassword", "email":"test@example.com"}' -H " Content-Type: application/json"
8082 ` ` `
8183
82842. Login to get a JWT:
8385 ` ` ` bash
84- curl -X POST http://localhost:3000/api/auth/login -d ' {"username ":"testuser ", "password":"testpassword"}' -H " Content-Type: application/json"
86+ curl -X POST http://localhost:3000/api/auth/login -d ' {"email ":"test@example.com ", "password":"testpassword"}' -H " Content-Type: application/json"
8587 ` ` `
8688
87893. Access a protected route:
8890 ` ` ` bash
89- curl -H " Authorization: Bearer <JWT>" http://localhost:3000/api/user /1
91+ curl -H " Authorization: Bearer <JWT>" http://localhost:3000/api/users /1
9092 ` ` `
9193
9294Replace ` < JWT> ` with the token received from the login endpoint.
0 commit comments