From 75d37a160a9b851b8530d5a905f60d38abf68531 Mon Sep 17 00:00:00 2001 From: Tokishu <111585037+Tok1shu@users.noreply.github.com> Date: Fri, 30 May 2025 17:19:15 -0700 Subject: [PATCH] Update README.md --- README.md | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bb59240..10c955f 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,40 @@ I'm testing spring boot, and it might become my main framework for building APIs -## Endpoits +## Authentication Endpoints +Handle user registration and login. All return JWT tokens on success. + +### `POST /api/auth/register` - Register a new user +Request body: +```json +{ + "username":"Tokishu", + "password":"SuperSecretPassword" +} +``` + +### `POST /api/auth/login` - Authorize +Request body: +```json +{ + "username":"Tokishu", + "password":"SuperSecretPassword" +} +``` + +### `/api/auth/new-root` - Initial setup endpoint to create a root user (e.g. admin), can only be used once. + +## Note Endpoints +All endpoints below require a valid Bearer token in the `Authorization` header. +`Authorization: Bearer ` + ### `GET /api/notes` - Get all notes ### `GET /api/note/{id}` - Find note by id ### `POST /api/note` - Add a new note -``` +Request body: +```json { "name":"What should I buy?", "text":"Tanya's note" @@ -16,7 +43,8 @@ I'm testing spring boot, and it might become my main framework for building APIs ``` ### `PUT /api/note/{id}` - Update note -``` +Request body: +```json { "name":"What should I buy?", "text":"I bought the apple!"