Giter Club home page Giter Club logo

express-gcp's Introduction

Node.js/Express Boilerplate for GCP ๐Ÿฃ

CircleCI Dependencies Dev Dependencies Size License

About

Boilerplate application for Node/Express on Google Cloud App Engine

Getting Started

Prerequisites

Google Cloud Platform project setup and the Google Quickstart "Before You Begin" steps followed.

You'll also need to change the PROJECT_ID in /config/default.js to your Google project id.

Installing

  1. npm install

Usage & Developing

  1. npm run dev
  2. Develop! ๐ŸŽ‰

Testing

We prefer to use [Mocha] combined with [Sinon] and [Chance] to unit test our applications. You can auto-run the tests using a tool called [Nodemon] which will auto-run the tests. Some helpful commands to use when you want to run a specfic set of tests are

nodemon --watch test --exec "Describe Block"

for this sample project you could use nodemon --watch test --exec "Index Router" which would run all the tests under

describe('Index Router', () => {
    it('should run this test', () => {});

    describe('GET /', () => {
        it('should also run this test', () => {});
    });
});

Logging

Logs for this application can be found in your GAE log page. There aren't many options for logging to Google Cloud that are still actively maintained other than the @google-cloud/logging package, so this project takes advantage of that. It follows the same interace as console so it won't be hard to swap to.

Deploying

  1. gcloud app deploy
  2. gcloud app browse

Circle CI

Create a service account that you'll use to deploy the application with after it has been built. It will need the following IAM roles:

  • App Engine Admin
  • App Engine Deployer
  • Cloud Build Editor
  • Storage Admin

After you've downloaded the credentials, copy the entire contents into an environment variable called GCLOUD_SERVICE_KEY under the url https://circleci.com/gh/<your username>/<your repo>/edit#env-vars. Be sure to add the GOOGLE_PROJECT_ID (which can be found in the dropdown of your Google Cloud Console). Last thing you need to add is the location you would deploy to, GOOGLE_COMPUTE_ZONE, your zone can be found under here

The first build in Circle will fail and it will tell you to enable the App Engine Admin API, do that and re-run

express-gcp's People

Contributors

cortl avatar cortlanbainbridge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.