-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(readMe): added docs for analyze routes
- Loading branch information
Showing
1 changed file
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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=<ENTER-YOUR-KEY-HERE>` > `IBM_WATSON_API_KEY=<ENTER-YOUR-APIKEY-HERE>` > `IBM_WATSON_API_URL=<ENTER-YOUR-PERSONAL-IBM-URL-HERE>` | ||
> `SECRET_JWT_KEY=|ENTER-YOUR-KEY-HERE|` <br/> | ||
> `IBM_WATSON_API_KEY=|ENTER-YOUR-APIKEY-HERE|` <br/> | ||
> `IBM_WATSON_API_URL=|ENTER-YOUR-PERSONAL-IBM-URL-HERE|` <br/> | ||
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 <br/> | ||
-Requires an email and password key inside the body <br/> | ||
-Example {email: [email protected], password: password1} <br/> | ||
-Example: | ||
> {email: [email protected], password: password1} <br/> | ||
- 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.(<br/> | ||
-Example {x-access-token: <X-ACCESS-TOKEN-KEY>} <br/> | ||
-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.<br/> | ||
-The x-access-token lasts for 24 hours. <br/> | ||
-Example | ||
> {x-access-token: |X-ACCESS-TOKEN-KEY|} <br/> | ||
**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 <br/> | ||
-Requires a diary entry and assigned to the message key in the body. <br/> | ||
-Example {message: "I love Tacos, it makes me think better during the day!"} <br/> | ||
-GET `/api/entry/listAll` allows a user to view all their previous entries and the overall tone for each one. <br/> | ||
-Example {message: "I love Tacos, it makes me think better during the day!"} <br/> | ||
-Will provide the entryToneId (will be labeled as "id" in the JSON) for each one <br/> | ||
-GET `/api/entry/sentencetone/:entryToneId` allows a user to see the tone for each sentence written in one entry.<br/> | ||
-Replace `:entryToneId` with the id in the URL. <br/> | ||
- POST `/api/entry/newEntry` allows registered user to submit a diary entry <br/> | ||
-Requires a diary entry and assigned to the message key in the body. <br/> | ||
- GET `/api/entry/listAll` allows a user to view all their previous entries and the overall tone for each one. <br/> | ||
-Will provide the entryToneId (will be labeled as "id" in the JSON) for each one <br/> | ||
-Example | ||
> {message: "I love Tacos, it makes me think better during the day!"} <br/> | ||
- GET `/api/entry/sentencetone/:entryToneId` allows a user to see the tone for each sentence written in one entry.<br/> | ||
-Replace `:entryToneId` with the id in the URL. <br/> | ||
|
||
### 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. <br/> | ||
-Example | ||
> {searchQuery: "taco"} <br/> | ||
- 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. <br/> | ||
-Example | ||
> {searchQuery: "taco"} <br/> | ||
> -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. <br/> | ||
- 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" <br/> | ||
-Requires a selected tone and assigned to the tone key in the body. <br/> | ||
-Example | ||
> {tone: "joy"} <br/> |