This is the backend API service for the Vivid app.
·
Report Bug
·
Request Feature
Please visit the frontend repository of this project and check out the readme there for a more in depth look at this project!
This backend repository was built to provide CRUD endpoints to the front end for users, dreams, and themes. This backend also provides as the middleman between the frontend and the Tone Analyzer Microservice. This repository saves, updates, retrieves and deletes user information, dream logs, and dream themes in the PostgreSQL database. When a user saves a dream journal entry, a request will be issued to the tone analyzer microservice containing a raw text body holding that journal entry. After analysis, the list of tones and their counts are transformed and saved to the database.
To view all the repositories associated with Vivid, please visit Vivid-Project
To properly use this application you will need to set up and configure three repositories. Follow the Configuration directions in each repository to get Vivd running locally! Alternatively, check out the production application here! Heroku puts some apps to sleep after a while; if loading the home page fails or times out, refreshing the page should be enough to see the app in production.
These setup instructions are for Mac OS.
- Fork and clone this repo into the directory that will house the Frontend or Microservice repositories.
- Install the Maven Command Line tool with Homebrew by entering
brew install maven
- Be sure to have PostgreSQL installed on your machine and create a new database titled
vivid
- Run the server from the command line by entering
mvn spring-boot:run
. This should seed the Postgres database with prepackaged seed data and allow you to make API calls from a tool such as Postman.
Request:
Uri: POST /users/authenticate
{
"email": "adrew@example.com",
"password": "password"
}
Response:
{
"id": 345,
"name": "Ava Drew",
"email": "adrew@example.com",
"token": "a6t9dvJW424Mw3BRHTfE5qiZg67-kXk_"
}
Request:
Uri: GET /user
Header: "Authorization": "Bearer <token>"
Response:
{
"id": 450,
"name": "Ava Drew",
"email": "adrew@example.com"
}
Request:
Uri: GET /dreams
Header: "Authorization": "Bearer <token>"
Response:
[
{
"id": 551,
"date": "02/22/2021",
"title": "Weird Dream",
"description": "This was very weird",
"emotion": "Fun",
"themes": [],
"toneAnalysis": {
"tone_strength": {
"Tentative": 1
},
"unique_tones": "Tentative"
}
}
{
...
}
]
Request:
Uri: GET /dreams
Header: "Authorization": "Bearer <token>"
Params(required): dateStart, dateEnd
Response:
[
{
"id": 3,
"date": "2021-02-23",
"title": "Cool Dream",
"description": "This is a good dream",
"emotion": "Happy",
"themes": [],
"toneAnalysis": {
"tone_strength": {
"Tentative": 1
},
"unique_tones": "Tentative"
}
},
{
"id": 4,
"date": "2021-02-24",
"title": "Bad Dream",
"description": "This was scary",
"emotion": "Bad",
"themes": [],
"toneAnalysis": {
"tone_strength": {
"Joy": 1
},
"unique_tones": "Joy"
}
},
{
...
}
]
Request:
Uri: GET /dreams/<dreamId>
Header: "Authorization": "Bearer <token>"
Response:
{
"id": 579,
"user": {
"id": 576,
"name": "Ava Drew",
"email": "adrew@example.com"
},
"date": "02/22/2021",
"title": "Weird Dream",
"description": "This was very weird",
"emotion": "Fun",
"themes": [],
"toneAnalysis": {
"tone_strength": {
"Tentative": 1
},
"unique_tones": "Tentative"
}
}
Request:
Uri: POST /dreams
Header: "Authorization": "Bearer <token>"
Raw JSON Body:
{
"date": "02/25/2021",
"title": "Train dream",
"description": "I was on a train",
"emotion": "Weird"
}
Response:
{
"id": 146,
"date": "02/25/2021",
"title": "Train dream",
"description": "I was on a train",
"emotion": "Weird",
"themes": [],
"toneAnalysis": {
"tone_strength": {
"Tentative": 1
},
"unique_tones": "Tentative"
}
}
Request:
URI: POST /users
Raw JSON Body:
{
"name": "Alex",
"email": "alex@example.com",
"password": "password123"
}
Response:
{
"id": 14,
"name": "Alex",
"email": "alex@example.com",
"token": "K157xIzmC9WBc7O4Rd6Ge2PV_jiwyfvN"
}
See Open Issues or visit our Project Board for a list of proposed features, known issues, and project extensions.
Contributions are what make this community such an amazing and fun place to learn, grow, and create! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch
git checkout -b feature/NewGreatFeature
- Commit your Changes
git commit -m 'Add some NewGreatFeature'
- Push to the Branch
git push origin feature/NewGreatFeature
- Open a new Pull Request!
Amanda Davidson - - GitHub - Turing Alum Profile
Shawn Truesdale - - GitHub
Jonathan Wilson - - GitHub - Turing Alum Profile
Zach Stearns - - GitHub - Turing Alum Profile
Aidan Murray - - GitHub
Taylor Phillips - - GitHub - Turing Alum Profile
Project Link: Vivid