From acda2de3a29bfa7bb000a5509492d7f0462e314d Mon Sep 17 00:00:00 2001 From: Fig Yogurt Date: Wed, 17 Feb 2021 04:24:54 -0500 Subject: [PATCH] feat(readMe): added docs for analyze routes --- README.md | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c62521e..a3bf43f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,9 @@ To run this application: 4. Make a new PostgreSQL database by writing `createdb mydiary` 5. Create a .env file by typing `touch .env` to store your secret keys 6. In the .env file type - > `SECRET_JWT_KEY=` > `IBM_WATSON_API_KEY=` > `IBM_WATSON_API_URL=` + > `SECRET_JWT_KEY=|ENTER-YOUR-KEY-HERE|`
+ > `IBM_WATSON_API_KEY=|ENTER-YOUR-APIKEY-HERE|`
+ > `IBM_WATSON_API_URL=|ENTER-YOUR-PERSONAL-IBM-URL-HERE|`
7. Type `npm run start-dev` in your terminal and you can use the API! ## API @@ -29,21 +31,41 @@ How to signup and login. - POST `/api/auth/signup` allows anyone to make an account
  -Requires an email and password key inside the body
-   -Example {email: test@test.com, password: password1}
+   -Example: + > {email: test@test.com, password: password1}
- POST `/api/auth/signin` when logged in, the response will give the user an access token. The access token must be placed in the header (with "x-access-token" as the key and the given accessToken as the value) -   -Requires an email and password key inside the body. You will receive an x-access-token. For all routes below you must place your token in the header.(
-   -Example {x-access-token: }
+   -Requires an email and password key inside the body. You will receive an x-access-token. For all routes below you must place your token in the header.
  -The x-access-token lasts for 24 hours.
+   -Example + > {x-access-token: |X-ACCESS-TOKEN-KEY|}
- **NOTE: All Routes below require your x-access-token in the header!** +**NOTE: All Routes below require your x-access-token in the header!** ### Entry Routes (Write Diary Entries/ Find Diary Entry or Sentence) --POST `/api/entry/newEntry` allows registered user to submit a diary entry
-  -Requires a diary entry and assigned to the message key in the body.
-  -Example {message: "I love Tacos, it makes me think better during the day!"}
--GET `/api/entry/listAll` allows a user to view all their previous entries and the overall tone for each one.
-  -Example {message: "I love Tacos, it makes me think better during the day!"}
-  -Will provide the entryToneId (will be labeled as "id" in the JSON) for each one
--GET `/api/entry/sentencetone/:entryToneId` allows a user to see the tone for each sentence written in one entry.
-  -Replace `:entryToneId` with the id in the URL.
+- POST `/api/entry/newEntry` allows registered user to submit a diary entry
+   -Requires a diary entry and assigned to the message key in the body.
+- GET `/api/entry/listAll` allows a user to view all their previous entries and the overall tone for each one.
+   -Will provide the entryToneId (will be labeled as "id" in the JSON) for each one
+   -Example + > {message: "I love Tacos, it makes me think better during the day!"}
+- GET `/api/entry/sentencetone/:entryToneId` allows a user to see the tone for each sentence written in one entry.
+   -Replace `:entryToneId` with the id in the URL.
+ +### Analyze Routes + +- GET `/api/analyze/search/entries/` allows a user to search their diary entries for any particular word. +   -Requires a word to be searched and assigned to the searchQuery key in the body.
+   -Example + > {searchQuery: "taco"}
+- GET `/api/analyze/search/sentences/` allows a user to search their diary entries for any particular word. Will only provide the exact sentences that match with the searched word. +   -Requires a word to be searched and assigned to the searchQuery key in the body.
+   -Example + > {searchQuery: "taco"}
+ > -GET `/api/analyze/averagetone` allows a user to find their average tone from all their diary entries. + >   -Will showcase the average tone for all 8 tones.
+- GET `/api/analyze/findToneMatch` allows a user to find all sentences within their entries that emit a certain tone +   -Tone's that a user can pick from are: "anger", "disgust", "fear", "joy", "sadness", "analytical", "confident", or "tentative"
+   -Requires a selected tone and assigned to the tone key in the body.
+   -Example + > {tone: "joy"}