The SoC Wellbeing Toolkit helps bootcampers manage their wellbeing using tools and resources in one handy location.
This is the back-end documentation for the app.
The back-end creates and populates tables on a postgres database. It also serves as an API for the front-end.
Looking for the Front-end?
git clone https://github.com/SchoolOfCode/w9_backend-project-power-coders-fe.git
cd w9_backend-project-power-coders-fe
npm i
To run this project, you will need to add a .env file to the root with the following environment variables.
PGHOST
PGDATABASE
PGUSER
PGPASSWORD
PGPORT
Assign these variables to your relevant database credentials.
To initialise and populate the database, run the following commands:
npm run db:resetResTable
npm run db:resetFeedTable
This is not yet deployed, so only works on localhost:3001 (back-end).
To run the back end:
npm run dev
GET /resources
fetch("http://localhost:3001/resources")
{success: true, message: "", payload: [
{
"id":1,"title":"Hero's Journey",
"description":"SoC is designed to challenge you. There may be times of doubt...",
"week":1,
"category":"Resilience",
"link":"https://www.mybestself101.org/blog/2021/2/2/adventure-mindset-the-heros-journey",
"author":"Joseph Trodden",
"image_path":"1_hero_journey.png"},
},
...]}
GET /resources/week/${weekNumber}
fetch("http://localhost:3001/resources/week/2")
{"success": true,"message": "Week resources","payload":[
{
"id":2,
"title":"Myers Briggs",
"description":"There are different types of people in the bootcamp and in the coding industry...",
"week":2,
"category":"Personality",
"link":"https://www.verywellmind.com/the-myers-briggs-type-indicator-2795583",
"author":"Joseph Trodden",
"image_path":"2_personality_types.png"
}
]}
GET /resources/category/${categoryName}
fetch("http://localhost:3001/category/resilience")
{"success":true,"message":"Category resources","payload":[
{
"id":1,
"title":"Hero's Journey",
"description":"SoC is designed to challenge you. There may be times of doubt and uncertainty... ",
"week":1,
"category":"Resilience",
"link":"https://www.mybestself101.org/blog/2021/2/2/adventure-mindset-the-heros-journey",
"author":"Joseph Trodden",
"image_path":"1_hero_journey.png"
}
]};
POST /feedback
fetch("http://localhost:3001/feedback", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: {
"name": "Craig Summers",
"coach": "Rikkiah Williams",
"score": 3
}
});
{"success": true, "message": "Feedback posted", "payload": [
{
"feedback_id": 5,
"time": "2022-06-28T15:19:18.547Z",
"name": "Craig Summers",
"coach": "Rikkiah Williams",
"score": 3
}
]
}
GET /feedback
fetch("http://localhost:3001/feedback")
{
"success": true,
"message": "All feedback",
"payload": [
{
"feedback_id": 1,
"time": "2022-06-28T10:48:37.480Z",
"name": "Craig",
"coach": "Rikki",
"score": 8
},
{
"feedback_id": 2,
"time": "2022-06-28T10:48:37.480Z",
"name": "Rajesh",
"coach": "Vicki",
"score": 7
},
}
- Additional ‘users’ table to store user data in DB
- Additional models and routes to facilitate logins using the users table
Currently implemented test suites check all CRUD operations on both routers (resources and feedback) and assert that the status code and data received is as expected.
To run tests, run the following command
npm run test
Server: Node, Express, PostgreSQL, Jest, Supertest
CRUD routes currently not used by Front-end:
- Get /resources
- Get /resources/category/${categoryName}
- Get /feedback
Documentation created using readme.so