- Use this wizard to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials.
- On the Add credentials to your project page, click the Cancel button.
- At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button.
- Select the Credentials tab, click the Create credentials button and select OAuth client ID.
- Select the application type Other, enter any name ("Gisela Test Google API"), and click the Create button.
- Click OK to dismiss the resulting dialog.
- Click the (Download JSON) button to the right of the client ID.
- Move this file to the
config/
directory and rename it toclient_secret.json
.
- Follow the instructions from https://developers.google.com/maps/documentation/geocoding/get-api-key?hl=en
- Write it down, save it, whatever. Just make sure, you can access it and don't have to rerun the whole process. Trust me, I've been there...
- Download mongoDB Community Server for your OS https://www.mongodb.com/download-center
- Install it...
- Run it
- Windows:
"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --dbpath d:\test\mongodb\data
- Linux: google it for yourself :)
- Windows:
- Grab NodeJS LTS (untested for non-LTS): https://nodejs.org/en/
- Clone this repo to your machine
- Install dependencies with
npm install
- Copy
config/options.example.js
and move it toconfig/options.prod.js
- Edit
config/options.prod.js
with your previous defined- MongoDB Uri
- Geocode API-Key
- CalendarID (you will find this in Gisela --> Calendar Settings)
- Start the backend with
node app.js
, it will listen onlocalhost:3000
per default. - On first run navigate to
http://localhost:3000/gcalfetch
. Then switch back to the bash where you started the backend, it will ask you to authenticate towards the calender with OAuth2. Copy the provided link from the console, navigate to it and paste the auth_code in the console once you are done. This has to be done once, afterwards your credentials are stored in yourconfig/
folder and you won't be asked again.
Endpoint | Call-Parameter | Type | Response |
---|---|---|---|
/gcalfetch |
{} |
GET |
<String> |
/positions |
{} |
GET |
Array<Object> |
-
/gcalfetch
- Grabs all calendar items and stores its items in MongoDB
- Caution: due to throttling this might take up to 5min!
- returns a string, notifying the user, that the process was initiated
-
/positions
-
returns all trips, including:
var TripSchema = new mongoose.Schema({ gCalID: {type: String, required: true, unique: true}, start: {type: Date, required: true}, end: {type: Date, required: true}, location: { name: String, latitude: {type: Number, required: true}, longitude: {type: Number, required: true}, distanceFromHome: Number }, description: String, summary: String, created_at: {type: Date, default: Date.now()}, updated_at: {type: Date, default: Date.now()} });
-