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.
-
Log out of your existing Gmail account and create a new Gmail account for this project, for example [email protected]
-
Go to the Google Cloud Platform
-
Accept the Terms and go to APIs & Services
-
Create a new project and give it a name, location is optional
-
Click on ENABLE APIS AND SERVICES, search for Calendar and enable the Google Calendar API
-
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?"
-
Now create a service account
- Give your service account a name, for example codaisseur-calendar
- Key type Select JSON
- Continue and create without role
-
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
-
Now go to Google Calendar with your newly created Gmail account
-
In the left column, under My calendars, click the dots beside your name on the left side and choose Settings and sharing
-
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.
- If you forgot your service account email go to IAM service accounts at Google Cloud Platform
-
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:
- Click on your Google profile icon in the top right, and click on Google Account.
- Click on Security on the bar at the top of the page.
- Scroll down to Access for less secure apps, and click Enable Access.
-
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
-
Clone the project
-
$ git clone git clone [email protected]:Official-Codaisseur-Graduate/calendar-api-server.git
-
Run
npm install
from the project folder -
Start the server with
node .
ornpx nodemon
, if you have nodemon installed -
You should see
listening to :4000
andConnected to database
in your terminal -
run
http :4000
and you should see{message": "incorrect url or authorization token required"}
-
Your server is running!
Go to the calendar-api-client repository and set up the front end.
- Login in with [email protected] and password: secret and then go to Admin Panel
-
Open the .json you downloaded earlier
-
The Google Calendar API configuration:
- You will find the client mail and the private key in the .json
-
The Google Calendar ID configuration:
-
The Mail verification configuration:
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.
-
Clone the
calendar-api-client
repository: -
$ git clone git clone [email protected]:Official-Codaisseur-Graduate/calendar-api-client.git
-
Run
npm install
from the project folder -
Start the client with
npm run start
-
The client should now automatically load in your browser.
-
Your client is running!