Skip to content

Commit

Permalink
feat(readMe): added docs for analyze routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-Aftab committed Feb 17, 2021
1 parent b35222a commit acda2de
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,21 +31,41 @@ How to signup and login.

- POST `/api/auth/signup` allows anyone to make an account <br/>
&nbsp;&nbsp;-Requires an email and password key inside the body <br/>
&nbsp;&nbsp;-Example {email: [email protected], password: password1} <br/>
&nbsp;&nbsp;-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)
&nbsp;&nbsp;-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/>
&nbsp;&nbsp;-Example {x-access-token: <X-ACCESS-TOKEN-KEY>} <br/>
&nbsp;&nbsp;-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/>
&nbsp;&nbsp;-The x-access-token lasts for 24 hours. <br/>
&nbsp;&nbsp;-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/>
&nbsp;&nbsp;-Requires a diary entry and assigned to the message key in the body. <br/>
&nbsp;&nbsp;-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/>
&nbsp;&nbsp;-Example {message: "I love Tacos, it makes me think better during the day!"} <br/>
&nbsp;&nbsp;-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/>
&nbsp;&nbsp;-Replace `:entryToneId` with the id in the URL. <br/>
- POST `/api/entry/newEntry` allows registered user to submit a diary entry <br/>
&nbsp;&nbsp;-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/>
&nbsp;&nbsp;-Will provide the entryToneId (will be labeled as "id" in the JSON) for each one <br/>
&nbsp;&nbsp;-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/>
&nbsp;&nbsp;-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.
&nbsp;&nbsp;-Requires a word to be searched and assigned to the searchQuery key in the body. <br/>
&nbsp;&nbsp;-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.
&nbsp;&nbsp;-Requires a word to be searched and assigned to the searchQuery key in the body. <br/>
&nbsp;&nbsp;-Example
> {searchQuery: "taco"} <br/>
> -GET `/api/analyze/averagetone` allows a user to find their average tone from all their diary entries.
> &nbsp;&nbsp;-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
&nbsp;&nbsp;-Tone's that a user can pick from are: "anger", "disgust", "fear", "joy", "sadness", "analytical", "confident", or "tentative" <br/>
&nbsp;&nbsp;-Requires a selected tone and assigned to the tone key in the body. <br/>
&nbsp;&nbsp;-Example
> {tone: "joy"} <br/>

0 comments on commit acda2de

Please sign in to comment.