Skip to content

Latest commit

 

History

History
118 lines (68 loc) · 4.93 KB

GETTING_STARTED.md

File metadata and controls

118 lines (68 loc) · 4.93 KB

Getting started

Important! For this project you will need to have a service account with Google. Both for contacting the Google Calendar API and for the email notifications steps.

Setting up the server will take you some time, so prepare yourself mentally now.

Step A: Setting up a Google's service account

  1. Log out of your existing Gmail account and create a new Gmail account for this project, for example [email protected]

  2. Go to the Google Cloud Platform

  3. Accept the Terms and go to APIs & Services

    Google cloud Platform

  4. Create a new project and give it a name, location is optional

  5. Click on ENABLE APIS AND SERVICES, search for Calendar and enable the Google Calendar API

  6. Imgur

  7. Click on Create credentials and then select "Help me choose" in the drop down menu

    • Which API are you using? Select Google Calendar API
    • Where will you be calling the API from? Select Web server (e.g. node.js, Tomcat)
    • _What data will you be accessing? Select Application Data
    • Are you planning to use this API with App Engine or Compute Engine? Select No, I'm not using them
    • Click on "What credentials do i need?"
  8. Now create a service account

    • Give your service account a name, for example codaisseur-calendar
    • Key type Select JSON
    • Continue and create without role
  9. Your service account and key were created, you have now automatically downloaded a json file, for example My Project 46545-ee94a5ed37e1.json.

    • Save it! You will need this information later in the setting up of the backend
  10. Now go to Google Calendar with your newly created Gmail account

  11. In the left column, under My calendars, click the dots beside your name on the left side and choose Settings and sharing

    • Google Calendar Sharing settings
  12. Scroll down to "Share with specific people" and click on "Add people". Insert the email address of your service account, (e.g. [email protected]) with the rights to "See all event details". Click send. If the account does not show while adding in the last process, because you can only add people from contacts.

  13. Go back to your Google Calendar and create some test events

Important! If you are going to use this Gmail account to send emails to the users, you need to perform the following steps:

  1. Click on your Google profile icon in the top right, and click on Google Account.
  2. Click on Security on the bar at the top of the page.
  3. Scroll down to Access for less secure apps, and click Enable Access.

Step B: Setup Backend

  1. Set up a Postgres database with docker at port 5432 with password secret:

    $ docker run -p 5432:5432 --name calendar-api -e POSTGRES_PASSWORD=secret -d postgres

  2. Clone the project

  3. $ git clone git clone [email protected]:Official-Codaisseur-Graduate/calendar-api-server.git

  4. Run npm install from the project folder

  5. Start the server with node . or npx nodemon, if you have nodemon installed

  6. You should see listening to :4000 and Connected to database in your terminal

  7. run http :4000 and you should see {message": "incorrect url or authorization token required"}

  8. Your server is running!


Step C: Configuration of the Google Calendar API in your app

Go to the calendar-api-client repository and set up the front end.

  1. Login in with [email protected] and password: secret and then go to Admin Panel

Admin panel

  1. Open the .json you downloaded earlier

  2. The Google Calendar API configuration:

    • You will find the client mail and the private key in the .json

    Google Calendar API

  3. The Google Calendar ID configuration:

    Calendar ID

  4. The Mail verification configuration:

    Mail verification

If all went well, you have now successfully setup your backend! IF you now go to Codaisseur Academy (the homepage) you should see the test events you created in Step A.

Setup of the frontend

  1. Clone the calendar-api-client repository:

  2. $ git clone git clone [email protected]:Official-Codaisseur-Graduate/calendar-api-client.git

  3. Run npm install from the project folder

  4. Start the client with npm run start

  5. The client should now automatically load in your browser.

  6. Your client is running!