COP4331-LargeGroupProject-Fall22 / backend

Backend for SmartChef project, see https://github.com/COP4331-LargeGroupProject-Fall22/SmartChef
0 stars 1 forks source link

API setup:

Mongo Database setup:

alt

alt

In the above example, "user" is username who has an access to your database cluster, and password is theirs password.

alt

Save password of that user and their username, you will use it in your connection string.

alt

alt

Environment variable names should be the same, the only parts that change are values.

Environment Variables:

Aside from environment variables for MongoDB we also utilize several other variables that should be initialized in .env file.

PORT should be defined with a port number for the server NODE_ENV if dev is assigned, server will use LOCAL_MONGODB_CONNECTION_STRING, otherwise MONGODB_CONNECTION_STRING is chosen for database connection.

MONGODB_CONNECTION_STRING defines connection string to the MongoDB account LOCAL_MONGODB_CONNECTION_STRING defines connection string to the local MongoDB account

PRIVATE_KEY_FOR_USER_TOKEN shoud be defined with the random string that will act as unique private key for bcrypt encryption

SPOONACULAR_API_KEY should be defined with a key to spoonacular api

SPOONACULAR_HOST="spoonacular-recipe-food-nutrition-v1.p.rapidapi.com"

SPOONACULAR_INGREDIENTS_BASE_URL="https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/food/ingredients" SPOONACULAR_GROCERY_PRODUCT_BASE_URL="https://api.spoonacular.com/food/products"

SPOONACULAR_RECIPE_BASE_URL="https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes"

Run Server:

To run server install latest npm and run npm install. All required packages will be installed automatically. Now, go to the project directory and run npm start.

Testing:

To run tests use npm run test or npm test.

User Endpoints:

https://app.swaggerhub.com/apis/mplekunov/Smart-Chef-API/1.0.0