/kenosha-parks

An Express REST API that wraps around Google Calendar and Drive API.

Primary LanguageJavaScript

Kenosha Parks

An Express application that exposes an API that wraps around Google Calendar API.

API

Refer to the API doc.

Google APIs

This project using the following APIs from Google:

  • Google Drive API
  • Google Calendar API

These APIs require authentication and you can do this by place the Firebase Admin service account credentials in the .env. The Express app will read these credntials, authorize Firebase Admin and the Google Node.js Client Library.

You must also enable the above Google APIs through the developer console.

Development Setup

Ensure you have at minimum:

  • Node.js >= 7.6
# Install dependencies
npm install

# If you have Yarn
yarn

Environment Variables

Create a copy of .env.example named .env. Populate the values with the Firebase service account values.

PRIVATE_KEY must be wrapped in quotes:

PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"

All other values can remain KEY=value format.

Launch Dev Server

Once you have the environment variables set, simply launch the dev server:

# npm
npm run dev

# Yarn
yarn dev

All requests not relating to /api will be redirected to City of Kenosha's website.

Production

Heroku/Dokku

Ensure you have set the environment variables via config:set.

Important

The PRIVATE_KEY value needs to contain literal double quotes in the value. Refer to this Stack Overflow answer for more information.

Deployment

Simply push to heroku/dokku and if all is well, the app should start up.