aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlexander_Kabui2024-08-02 20:19:03 +0300
committerAlexander_Kabui2024-08-02 20:19:03 +0300
commit39c1546f8e3769c857ec8581e418f19c7e54128d (patch)
tree8628cd824d9eeef2ad4e20f292e83e2afc25eef7 /README.md
parent0e8e6f36ec24aeb606974941640ebce043b05600 (diff)
downloadgn-guile-39c1546f8e3769c857ec8581e418f19c7e54128d.tar.gz
Add documentation for gn-markdown editor
Diffstat (limited to 'README.md')
-rw-r--r--README.md102
1 files changed, 102 insertions, 0 deletions
diff --git a/README.md b/README.md
index c7f367b..c229152 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,108 @@ Next fire up emacs with `emacs-geiser-guile` and connect to the running web serv
Some tooling and scripts that run independently are stored in `./scripts`.
+Here’s the entire markdown content combined into a single, copyable file:
+
+
+# Gn-Markdown
+
+Gn-Markdown is an API endpoint to edit, parse, and commit markdown files for gn-docs.
+
+## How to Test the APIs
+
+1. **Navigate to the Web Directory and Start the Server**
+
+ ```sh
+ cd web
+ . .guix-shell -- guile -L .. --listen=1970 -e main ./webserver.scm 8091
+ ```
+
+2. **Test Endpoints**
+
+ The main endpoints provided are `/edit` and `/commit`. More endpoints may be added in the future.
+
+## Edit (GET)
+
+This is a GET request to retrieve a file's details.
+
+**Request Example:**
+
+```
+localhost:8091/edit?file_path=test.md
+```
+
+**Expected Success Response:**
+
+```json
+{
+ "path": "test.md",
+ "content": "Test for new user\n test 2 for line\n test 3 for new line\n ## real markdown two test\n",
+ "hash": "ecd96f27c45301279150fbda411544687db1aa45"
+}
+```
+
+**Expected Error Response (Status 400):**
+
+```json
+{
+ "error": "file-error",
+ "msg": "The file path /home/kabui/test_repo/test.md does not exist"
+}
+```
+
+## Commit (POST)
+
+This is a POST request to commit changes to a file.
+
+**Request URL:**
+
+```
+localhost:8091/commit
+```
+
+**Request Body Example:**
+
+```json
+{
+ "content": "Test for new user\n test 2 for line\n test 3 for new line\n ## real markdown two test\n",
+ "filename": "test.md",
+ "username": "genetics",
+ "email": "genetics@gmail.com",
+ "commit": "commit by genetics"
+}
+```
+
+**Expected Success Response:**
+
+```json
+{
+ "status": "201",
+ "message": "Committed file successfully",
+ "content": "Test for new user\n test 2 for line\n test 3 for new line\n ## real markdown two test\n",
+ "commit-sha": "47df3b7f13a935d50cc8b40e98ca9e513cba104c",
+ "commit-message": "commit by genetics"
+}
+```
+
+**If No Changes to File:**
+
+```json
+{
+ "status": "200",
+ "message": "Nothing to commit, working tree clean",
+ "commit-sha": "ecd96f27c45301279150fbda411544687db1aa45"
+}
+```
+
+**Expected Error Response:**
+
+```json
+{
+ "error": "system-error",
+ "msg": "Commits do not match. Please pull in the latest changes for the current commit *ecd96f27c45301279150fbda411544687db1aa45* and previous commits."
+}
+```
+
# Development
```