From b35222a007e424a85dbe4bf6c9e4a3a9bcc7870c Mon Sep 17 00:00:00 2001 From: Fig Yogurt Date: Wed, 17 Feb 2021 03:57:45 -0500 Subject: [PATCH] refactor(readMe): add more clear instructions and added docs for entry routes --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9593902..c62521e 100644 --- a/README.md +++ b/README.md @@ -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=` > `IBM_WATSON_API_KEY=` > `IBM_WATSON_API_URL=` 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
  -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. Also the x-access-token inside the header.
+   -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: }
  -The x-access-token lasts for 24 hours.
+ + **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.