This is the repo for our server and database, where we have built the API routes, postgresql queries and tests. Our API CRUD routes are connected to our database (Heroku) and the data is fed to our frond end via the GET routes.
“With the COVID pandemic and now the cost of living crisis, many people have been cooking at home more than ever. However, having to come up with interesting recipes for the ingredients you have, sometimes multiple times per day, can lead to decision fatigue and sap the joy out of home cooking”.
“Chews” is a web app that helps you easily choose a meal recipe to make at home, taking the tiresome decision-making out of your hands.
- Login/Sign up for new users
- Meal type selection page
- Search by items page
- Result page to display recepet selection
- Display full recepet with the instructions
- Save favourite recepet and display page
Method | Path | Additional Info | Result | Response |
---|---|---|---|---|
GET | ~/users/userid | Specific user details | {success: true, payload: user details object} | |
POST | ~/users | {name: string, dietary-preferences: [strings], ?image-link: string, ?nationality: string} | User profile created | {success: true, payload: {userid: userid}} |
PUT | ~/users/userid | {name: string, dietary-preferences: [strings], ?image-link: string, ?nationality: string} | User details updated | {success: true, payload: “user profile updated” |
DELETE | ~/users/userid | User of specified id deleted | {success: true, payload: “user profile deleted” |
Method | Path | Additional Info | Result | Response |
---|---|---|---|---|
GET | ~/users/recipes/userid | {favourites: [{recipeid: number, title: string, imageURL: string}]} | Specific saved recipes | {success: true, payload: user collected recipes} |
POST | ~/users/recipes | {userid: number, favourites: [{recipeid: number, title: string, imageURL: string}]} | User profile created | {success: true, payload: “${name}’s profile created”} |
PUT | ~/users/recipes/userid | {userid: number, favourites: [{recipeid: number, title: string, imageURL: string}]} | User details updated | {success: true, payload: “${name}’s profile updated” |
DELETE | ~/users/recipes/userid | User of specified id deleted | {success: true, payload: “${name}’s profile deleted” |
Database: Heroku
Server: Node, Express, Nodemon, pg, dotenv (cors to review)
To run tests, run the following command
npm run test
Clone the project
https://github.com/mauriziomonti/baristacrats-backend-final-project.git
Install dependencies
npm install
Start the server
npm run dev
Create .env file. (To decide which configuration below to be used)
PGPORT=<Your database port>
PGHOST=<Your database host>
PGDATABASE=<Your database reference>
PGUSER=<Your database username>
PGPASSWORD=<Your database password>
PGCONNECTIONSTRING=<Connection string provided>
Run these scripts to create the tables on your database:
User
npm run <db drop functionality>
npm run <db create functionality>
npm run <db populate functionality>
Recipes
npm run <db drop functionality>
npm run <db create functionality>
npm run <db populate functionality>