API with an RSVP system that interacts with the Google Calendar.
Endpoints include create_event
, rsvp_event
, and list_rsvp
.
- Node.js with npm
- MongoDB Atlas Account
- Google Account
- Download the repository
- Create a
.env
file in the repository with the following:
API_KEY=yourMadeUpKey
CALENDAR_ID=
URI=
CLIENT_ID=
CLIENT_SECRET=
REDIRECT_URI=
- Log into your Atlas account
- Create a new cluster
- Choose allowed IPs
- Create a database account
- Choose
Connect your application
- Copy the provided
uri
into the.env
URI field
- Log into your google account
- Go to the Google Developer Console
- Create a new project
- Enable Google Calendar API through the API library
- Navigate to
credentials
- Click create credentials
- Click OAuth Client ID
- Select Web application
- Add a URI ending with
/oauth2callback
(eg.http://localhost:3000/oauth2callback
) - Download the auth client file
- Copy the approperiate fields from the auth file into the approperiate
.env
fields - Navigate to
OAuth consent screen
- Add a test user
- Write your google account email
- Go to the Google Calendar
- (Optional) Create a new calendar
- Navigate to the calendar's settings
- Copy the Calendar ID into the
.env
CALENDAR_ID field
- Run the app with
npm start
- Click the link generated in the console
- Authorize the application
Subsequent npm start
should now start the application without asking for authorization
This API is hosted on Heroku:
- hostname:
rsvp-calendar-api.herokuapp.com
- api_key:
apikey123
You can check the calendar here.
Apps on Heroku tend to sleep after being idle for some time which means it may take a while to initially process an API request.
POST /create_event
Eg. http://localhost:3000/create_event
{
"api_key": "superSecret",
"event_name": "Cool ACM event",
"start_date": "2021-09-16 3:59 PM",
"end_date": "2021-09-16 4:59 PM"
}
=>
event_id
POST /rsvp_event
Eg. http://localhost:3000/rsvp_event
{
"api_key": "superSecret",
"event_id": "sOmeThinGlIkEtHat25123",
"attendee_name": "John Doe"
}
=>
db_insertion_id
GET /list_rsvp
Eg. http://localhost:3000/read_messages
{
"api_key": "superSecret",
"event_id": "sOmeThinGlIkEtHat25123"
}
=>
[{
"attendee_name": "John Doe"
}]