I have no idea what I'm doing, but here Goes #2 Yay! Json!!

jamonjamon

Jaimie Carter

Posted on June 24, 2019

I have no idea what I'm doing, but here Goes #2 Yay! Json!!

Well folks if you've been playing along, the goal here is to further make life easier with tWC2k (the Work Chaser 2000!) by automating the never ending treadmill that afflicts all freelancers - the work hustle, thus freeing up to for me to surf and drink beer with my friends. "A noble goal!" I hear you cry. Yes, yes it is.

So, after a busy weekend of work (cue the violins again), I sat down this morning and thought, "how will this actually work?" In the last post I thought maybe the right way to go would be to build an express app, then test the end points with Postman - and then connect that to the Google Calendar API. But, if you think about it (there it goes again, this whole 'thinking' thing... shudder), maybe I need to see if I can get stuff out of the Google API first. Probably a good idea not to put the horse before the cart, right? Let's get something, anything out of a Google Calendar, first. Fine. Now, that's all great, but how does one do that? Ah. Lightbulb. One could ask Google, I suppose? (I know, it's bordering on genius again) It turns out there's a npm script you run and hey-presto! There's your connection to a Calendar with the last 10 events listed. Even a dullard like me managed to do it.

The thing I managed to get working is on my GitHub. It manages to pull the last 20 events from a Google calendar and display them as a json object in the browser. The little bit of code that is there is like my house - a total mess, I apologise in advance, if you're going to look at it.

Next up: to use this json to find the holes in my calendar and make a new json with available dates.

Thoughts?

💖 💪 🙅 🚩
jamonjamon
Jaimie Carter

Posted on June 24, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related