-
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.
refactor(readMe): add more clear instructions and added docs for entr…
…y routes
- Loading branch information
Showing
1 changed file
with
22 additions
and
3 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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
# myDiary | ||
|
||
Diary based website that utilizes Artificial Intelligence to detect the sentiment analysis of the user’s diary entry. This project used Node.js, Express, PostgreSQL, and Sequelize. | ||
Diary based API that utilizes Artificial Intelligence to detect the sentiment analysis of the user’s diary entry. This project used Node.js, Express, PostgreSQL, and Sequelize. | ||
|
||
## Requirements | ||
|
||
You need [Node.js/NPM](https://nodejs.org/) and [Git](https://git-scm.com/) installed into your system. Also go to [IBM Cloud](https://cloud.ibm.com/) to register and sign up for the free tier service for their Tone Analyzer. _Remember to get your API Key and API URL!_ | ||
|
||
## Get Started | ||
|
||
|
@@ -11,7 +15,8 @@ To run this application: | |
3. To install the required modules type `npm i` | ||
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=ENTERYOURKEYHERE` | ||
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>` | ||
7. Type `npm run start-dev` in your terminal and you can use the API! | ||
|
||
## API | ||
|
@@ -26,5 +31,19 @@ How to signup and login. | |
-Requires an email and password key inside the body <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. Also the x-access-token inside the header.<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/> | ||
-Example {x-access-token: <X-ACCESS-TOKEN-KEY>} <br/> | ||
-The x-access-token lasts for 24 hours. <br/> | ||
|
||
**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/> |