We're using the GNU General Public License v3.0 so please keep this in mind if you'd like to use my code.
Dish exchange is supposed to be matching application app, where people can add their dishes to their profile and match with other people's dishes to eventually "exchange" their own home-made dishes in person. This application is for a school project so not all features are available. In Features we will explain which features are available.
This concept is for people who love cooking, tasting food and love to share their food with the world. It's an easy and cheaper way to experience food from all kinds of people you would be able to find on the app. It was inspired by people who are big foodies, who cannot afford all the time to eat out and try different dishes and flavours, because that can be very expensive.
As explained earlier, this project is a school project, so not all features you would expact a matching application to have, will be available.
We have several features, such as:
- being able to register an acoount
- being able to login
- being able to create, modify and delete your own dishes within the application
- Being able to filter your own created dishes
To help you use my application, I set up a guide on how to use it.
To be able to use my application you will need a few things:
- Any code editor
- Terminal for Linux
- Git
- Npm
- A mongoDB database (free)
- A spoonacular account
- Your own
.env
file within this repository (I recommend using my.envSample
and renaming it to.env
)
If you have any trouble of questions with the installation, please don't hesitate and send me a message!
- Open Linux in the terminal
- In the terminal: locate yourself in the folder you want the local repository to be in
- Copy the link of my repository - The link of my repository, can be found at the top of this page if you press on the
code
button and and then the copy button. - Use
git clone [LINK OF MY REPOSITORY]
in the terminal - Use
npm install
in the terminal to install the required node modules
Like I said before, you will need a mongoDB database and a Spoonacular account, which I'll explain below.
First I'll explain how to create a new project and a cluster
- Make a mongoDB account on "https://www.mongodb.com/" (it's free!)
- Create a new project by clicking on the green button saying
new project
button in MongoDB (if you're not on the homepage, click on the leaf in the top left corner on the page to return to the homepage) - Create a cluster by clicking on the green button saying
build a database
(any settings are fine, a shared cluster is free) - MongoDB sends you to a
security quickstart
. In here you'll be making a user that can use your database. You will need the password of this user later for in your.env
file! (see step 19) - If you scroll down on the
security quickstart
you will see that there's a button sayingadd my current IP adress
. Click on it to add you IP to the IP Access list (otherwise you won't have access to your cluster) - Click on
finish and close
followed bygo to database
In the following steps I'll explain how to create a collection in MongoDB
- ATTENTION: (PLEASE NOTE TO USE THE SAME NAMES AS I'M USING, OTHERWISE THE APPLICATION MIGHT NOT WORK AND YOU'LL HAVE TO FIX THIS YOURSELF IN SERVER.JS)
- Now you should see
database deployments
of your cluster. To create a collection, click onbrowse collections
followed byadd my own data
- Name the database
dishexchange
and call the collectiondishes
(PLEASE USE THE SAME NAMES OTHERWISE THE APPLICATION MIGHT NOT WORK!)
Now that you have your database set up, I'll explain in the following steps on how to connect your cluster with the application. For this you will need your own .env
file (I recommend using .envSample
and renaming it to .env
)
- Use my
.envSample
file in this repository and rename it to.env
(I recommend using this file, because all you need to change is the value of the variables) - To connect your mongoDB cluster, go to your mongoDB cluster, click on
database
(on the left) and click onconnect
- Because we're using the Node.js driver to connect mongoDB, click on
connect your application
- Make sure that
driver
is set toNode.js
- In the variable
DB_HOST:
of the.env
file, you copy whatever is written in the string fromcluster
(after the @) untilmongodb.net
. - In the variable
DB_NAME:
of the.env
file, you write the name of the collection, which is in this casedish-exchange
. - In the variable
DB_USER:
of the.env
file, you write the name of the user you created in step 9. - In the variable
DB_PASS:
of the.env
file, you write the password of the user you created in step 9. - In the variable
SESSION_SECRET:
of the .env file, you write a random password for your session.
The session secret is a key used for signing and/or encrypting cookies set by the application to maintain session state. In practice, this is often what prevents users from pretending to be someone they're not ensuring that random person on the internet cannot access your application as an administrator.
MongoDB should now be connected to this application!
To be able to use Spoonacular, you will need an API key. I'm only using spoonacular as a progressive enhancement, so that as a user you can make a picture of a dish and Spoonacular will try to "guess" the name of the dish and add this "guess" as name in the form, so you won't have to type the name of the dish yourself.
- Create a Spoonacular account on: "https://spoonacular.com/food-api/docs/detect-foods-in-text" (it's free!)
- Go to your Spoonacular profile (on the left, below API Console)
- Click on
show / hide API key
to show your API key - Copy your API key
- Paste your API key as the value of the variable
API_KEY
in your.env
file
Now you should have everything you need and you're ready to go! test
We worked as a team of 4 with the following team members: Ruben Finnerud, Vanessa Choe, Dave Dankwah and Roshnie de Groen.