Registers a new user.
-
Request:
- Body:
{ "name": "John Doe", "email": "johndoe@example.com", "password": "password123", "bio": "Loves collecting things." }
- Body:
-
Response:
- Status:
201 Created - Body:
{ "id": 1, "name": "John Doe", "email": "johndoe@example.com", "bio": "Loves collecting things." }
- Status:
Logs in a user and returns access and refresh tokens.
-
Request:
- Body:
{ "email": "johndoe@example.com", "password": "password123" }
- Body:
-
Response:
- Status:
200 OK - Body:
{ "id": 1, "name": "John Doe", "accessToken": "access-token", "refreshToken": "refresh-token" }
- Status:
Refreshes the access token using the refresh token.
-
Request:
- Cookies:
refreshToken: "refresh-token"
- Cookies:
-
Response:
- Status:
200 OK - Body:
{ "accessToken": "new-access-token" }
- Status:
Logs out a user and clears the refresh token cookie.
-
Request: None
-
Response:
- Status:
200 OK - Body:
{ "message": "Logged out" }
- Status:
Gets all things. No authentication required.
-
Request: None
-
Response:
- Status:
200 OK - Body:
[ { "id": 1, "name": "Thing 1", "description": "Description of Thing 1", "user_id": 1, "user_name": "John Doe" }, { "id": 2, "name": "Thing 2", "description": "Description of Thing 2", "user_id": 2, "user_name": "Jane Doe" } ]
- Status:
Gets a specific thing by ID. No authentication required.
-
Request:
- Params:
id
- Params:
-
Response:
- Status:
200 OK - Body:
{ "id": 1, "name": "Thing 1", "description": "Description of Thing 1", "user_id": 1, "user_name": "John Doe" }
- Status:
Gets all users. Requires authentication.
-
Request: None
-
Response:
- Status:
200 OK - Body:
[ { "id": 1, "name": "John Doe", "email": "johndoe@example.com", "bio": "Loves collecting things." }, { "id": 2, "name": "Jane Doe", "email": "janedoe@example.com", "bio": "Loves collecting other things." } ]
- Status:
Gets a specific user by ID. Requires authentication.
-
Request:
- Params:
id
- Params:
-
Response:
- Status:
200 OK - Body:
{ "id": 1, "name": "John Doe", "email": "johndoe@example.com", "bio": "Loves collecting things." }
- Status:
Gets things for a specific user by ID. Requires authentication.
-
Request:
- Params:
id
- Params:
-
Response:
- Status:
200 OK - Body:
[ { "id": 1, "name": "Thing 1", "description": "Description of Thing 1", "user_id": 1 }, { "id": 2, "name": "Thing 2", "description": "Description of Thing 2", "user_id": 1 } ]
- Status:
Gets all things for the logged-in user. Requires authentication.
-
Request: None
-
Response:
- Status:
200 OK - Body:
[ { "id": 1, "name": "My Thing 1", "description": "Description of My Thing 1", "user_id": 1 }, { "id": 2, "name": "My Thing 2", "description": "Description of My Thing 2", "user_id": 1 } ]
- Status:
Adds a new thing for the logged-in user. Requires authentication.
-
Request:
- Body:
{ "name": "New Thing", "description": "Description of New Thing" }
- Body:
-
Response:
- Status:
201 Created - Body:
{ "id": 3, "name": "New Thing", "description": "Description of New Thing", "user_id": 1 }
- Status:
Updates a specific thing for the logged-in user. Requires authentication.
-
Request:
- Params:
id - Body:
{ "name": "Updated Thing", "description": "Updated Description" }
- Params:
-
Response:
- Status:
200 OK - Body:
{ "id": 1, "name": "Updated Thing", "description": "Updated Description", "user_id": 1 }
- Status:
Deletes a specific thing for the logged-in user. Requires authentication.
-
Request:
- Params:
id
- Params:
-
Response:
- Status:
204 No Content
- Status: