- Project aim
- Technologies
- Setup
- Examples of use
- Project Status
- Authors
- Project Presentation
- Resources
Create an RESTapi which allows users to request data about available fruits, herbs or vegetables to harvest in urbanized areas (for example London). The API would allow users to request all available harvests as well as filter them by types (for example apples, pears, basil etc.). We also wanted authorised users to be able to update information about harvests aswell as delete them if the data is not correct or relavant anymore.
We used:
- VScode (live share)
- Insomnia
- Whimsical (file structure blueprint)
- Dbdiagram (schema design)
- Miro (for crazy 8's)
- Git / Github (including CI)
- Heroku (for deployment)
- NodeJS / Express
- PostgreSQL
- Javascript
- NPM package manager (https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- PSQL (https://www.postgresql.org/download/)
- Clone the repo
- Run 'npm install' in terminal
- Run 'psql' in terminal (for database setup)
- Setup user if you need (CREATE USER username SUPERUSER PASSWORD 'password';
- Connect to our heroku database \connect [url can be found in our slack FAC20 channel]
- Run 'npm start' (to start server on localhost:4000)
- For testing enter 'npm run test'
- To view all harvests [/harvest] - Mehtod:[GET], Example: http://localhost:4000/harvest
- To select specific harvest [/harvest/type]- Mehtod:[GET], Example: http://localhost:4000/harvest/apple (does not show error if harvest is not found)
- To signup [/signup]- Mehtod:[POST], Example: http://localhost:4000/signup
In the body fo your request add object following keys: "username", "email", "password" Example:
{
"username": "tom",
"email": "[email protected]",
"password": "12345"
}
Important! After recieving token save it in your authorization header
- To login [/login]- Mehtod:[POST], Example: http://localhost:4000/login
In the body fo your request add object following keys: "username", "password" Example:
{
"username": "tom",
"password": "12345"
}
Important! After recieving token save it in your authorization header
- To login [/harvest]- Mehtod:[POST], Example: http://localhost:4000/harvest
Important! If you did not save authorization token you will not be permited to create new post! Login or Signup First!
In the body fo your request add object following keys: "food_type", "taste", "harvest_time", "location", "date" Example:
{
"food_type": "mint",
"taste": "fresh",
"harvest_time": "winter",
"location": "ealing_broadway",
"date": "27th August 2020"
}
- Code reviewing and debuging
FAC20 Group - week7-CHJM
Trish, Jennifer, Josh, Rihards
https://hackmd.io/KALRsQsZSg-7lf9UZwIfnQ?both
https://github.com/oliverjam/learn-express-middleware
https://github.com/oliverjam/learn-rest-apis
https://github.com/expressjs/cors
https://github.com/oliverjam/learn-password-security
https://www.youtube.com/playlist?list=PLdk7iMWTjWaqMJXzhx3RlPAdmFNRLgOrF
https://www.tutorialspoint.com/nodejs/nodejs_express_framework.htm
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs