You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Note: You should go to "https://www.themealdb.com/" to create your own account and replace the value with your own api key. But for demonstrantion simplicity we provide you with the api key for now.*
46
+
1. first run `cd back-end` to navigate to back-end folder
47
+
2. then run `npm install` to install the back-end dependencies
48
+
3. create a `.env` file in the back-end directory with the following content:
*Note: For this project, we have provided the following credentials. However, for real projects, please visit "https://www.themealdb.com/" to create an account and replace <MEAL_DB_API_KEY> with your own API key. Similarly, replace <MONGODB_URI> and <SPOONACULAR_API_KEY> with your respective API keys.*
54
60
55
61
### Running
62
+
1. If you are testing either the front-end or back-end, you can run `npm start` in the corresponding folder.
63
+
2. If you are running both the front-end and back-end together, run `npm start` separately in each folder and view the app on http://localhost:3001.
64
+
3. If you are using a Windows PC, please run `npm run start-pc` instead of `npm start` for the front-end.
56
65
57
-
1. if you are only running the front-end or back-end for testing purpose, you can simply run `npm start` in the corresponding front-end/back-end folder
58
-
2. if you are running both front-end and back-end, please first run `npm start` in the back-end folder and then in the front-end folder. When you encounter the question `Would you like to run the app on another port instead? › (Y/n)`, type "y" to run the front-end on port 3001.
59
-
3. if you are working on a Windows PC, please use `npm run start-pc` instead for front-end.
66
+
## Deployed front-end
67
+
To view our front-end code live on the web, go to https://monkfish-app-fjlpj.ondigitalocean.app/
60
68
61
-
*Note: some of our pages won't work properly if you run back-end on port 3000 and front-end on port 3001*
62
-
4. now you can open [http://localhost:3000](http://localhost:3000) in your browser to view our app.
Copy file name to clipboardexpand all lines: back-end/README.md
+40-24
Original file line number
Diff line number
Diff line change
@@ -13,39 +13,55 @@ To install the back-end dependencies, run the following command in the terminal:
13
13
14
14
## Running the Server
15
15
To start the back-end server, run the following command in the terminal:
16
-
`npm start`
17
-
Please make sure if you run front-end first before you start the back-end server.
16
+
`npm start`.
18
17
This will start the server at http://localhost:3000.
19
18
20
19
API Endpoints
21
20
The back-end provides the following API endpoints:
22
21
23
-
/recipes - GET
24
-
/recipes/sort-by-time - GET
25
-
/recipes/sort-by-difficulty - GET
26
-
/recipes/:id - GET
27
-
/search - GET
28
-
/random-recipe -GET
29
-
/my-ingredients - GET, POST
30
-
/search-ingredient - GET
31
-
/utensils - GET, POST
32
-
33
-
## API_KEY/Database Configuration
22
+
- POST /auth/signup: sign up a new user account
23
+
- POST /auth/login: log in to an existing user account
24
+
- POST /auth/logout: log out of an existing user account
25
+
- GET /auth/user: get the current user's information
26
+
- POST /auth/reset_password: request to reset the user's password
27
+
- PUT /auth/reset_password/:token: reset the user's password using a password reset token
28
+
- GET /recipes: get all recipes
29
+
- GET /recipes/:id: get a single recipe by ID
30
+
- POST /recipes: add a new recipe
31
+
- PUT /recipes/:id: update an existing recipe by ID
32
+
- DELETE /recipes/:id: delete an existing recipe by ID
33
+
- GET /ingredients: get all ingredients
34
+
- GET /ingredients/:id: get a single ingredient by ID
35
+
- POST /ingredients: add a new ingredient
36
+
- PUT /ingredients/:id: update an existing ingredient by ID
37
+
- DELETE /ingredients/:id: delete an existing ingredient by ID
38
+
- GET /utensils: get all utensils
39
+
- GET /utensils/:id: get a single utensil by ID
40
+
- POST /utensils: add a new utensil
41
+
- PUT /utensils/:id: update an existing utensil by ID
42
+
- DELETE /utensils/:id: delete an existing utensil by ID
43
+
- POST /share-recipes: upload a new recipe
44
+
- POST /cookie: set a cookie for the user
45
+
- GET /protected: get some protected content that requires authentication
46
+
- POST /contact-us: send a message through the contact us form.
47
+
48
+
## External APIs / Database Configuration
34
49
The back-end connects to relevant APIs and a MongoDB database. To configure the database connection, create a .env file in the root directory with the following information:
35
-
'''
36
-
MEAL_DB_API_KEY=<meal_db_api_key>
37
-
DB_HOST=<database_host>
38
-
DB_NAME=<database_name>
39
-
DB_USERNAME=<database_username>
40
-
DB_PASSWORD=<database_password>
41
-
'''
42
-
Go to "https://www.themealdb.com/" to create an account.
43
-
Replace <meal_db_api_key> with your own api key.
44
-
Replace <database_host>, <database_name>, <database_username>, and <database_password> with your actual database information.
For this project, we have provided the following credentials. However, for real projects, please visit "https://www.themealdb.com/" to create an account and replace <MEAL_DB_API_KEY> with your own API key. Similarly, replace <MONGODB_URI> and <SPOONACULAR_API_KEY> with your respective API keys.
45
61
46
62
## Unit testing
47
63
To run the test suite and generate a code coverage report using Istanbul NYC, you can use the following command:
48
-
`npx nyc mocha --exit`
64
+
`npm test`
49
65
50
66
## Contributing
51
67
To contribute to the back-end, please follow these steps:
Copy file name to clipboardexpand all lines: front-end/README.md
+8-68
Original file line number
Diff line number
Diff line change
@@ -2,73 +2,13 @@
2
2
3
3
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4
4
5
-
## Setting up
6
-
1. run `npm install`, please ignore the error appeared for now, we will resolve it later.
7
-
2. then run `npm i @material-ui/core --force --save`
5
+
## Installation
6
+
To install the front-end dependencies, run the following command in the terminal:
7
+
`npm install`
8
8
9
-
## Available Scripts
9
+
## Running the Server
10
+
To start the front-end server, run the following command in the terminal:
11
+
`npm start`. This will start the server at http://localhost:3001.
10
12
11
-
In the project directory, you can run:
12
-
13
-
### `npm start`
14
-
**Note**: Please run the front-end first before you start the back-end server.
15
-
Runs the app in the development mode.\
16
-
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
17
-
18
-
The page will reload when you make changes.\
19
-
You may also see any lint errors in the console.
20
-
21
-
### `npm test`
22
-
23
-
Launches the test runner in the interactive watch mode.\
24
-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
25
-
26
-
### `npm run build`
27
-
28
-
Builds the app for production to the `build` folder.\
29
-
It correctly bundles React in production mode and optimizes the build for the best performance.
30
-
31
-
The build is minified and the filenames include the hashes.\
32
-
Your app is ready to be deployed!
33
-
34
-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
35
-
36
-
### `npm run eject`
37
-
38
-
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
39
-
40
-
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
41
-
42
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
43
-
44
-
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
45
-
46
-
## Learn More
47
-
48
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
49
-
50
-
To learn React, check out the [React documentation](https://reactjs.org/).
51
-
52
-
### Code Splitting
53
-
54
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
55
-
56
-
### Analyzing the Bundle Size
57
-
58
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
59
-
60
-
### Making a Progressive Web App
61
-
62
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
63
-
64
-
### Advanced Configuration
65
-
66
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
67
-
68
-
### Deployment
69
-
70
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
71
-
72
-
### `npm run build` fails to minify
73
-
74
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
13
+
## Deployed front-end
14
+
To view our front-end code live on the web, go to https://monkfish-app-fjlpj.ondigitalocean.app/
0 commit comments