GithubHelp home page GithubHelp logo

isabella232 / serverless-cloud-maker-next-18 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/serverless-cloud-maker-next-18

0.0 0.0 0.0 431 KB

License: Apache License 2.0

JavaScript 100.00%

serverless-cloud-maker-next-18's Introduction

Serverless Cloud Maker

This repository contains the source code for the backend of the Cloud Maker showcase for Google Cloud Next 2018. It uses Google Cloud Functions on Node.js to implement a set of image transformation functions that combine the Google Cloud Vision API with ImageMagick to manipulate image data in interesting ways.

It contains a handler function that can be deployed as a service to enable users to specify arbitrary combinations of functions to be applied to arbitrary image data.

The inventory of functions is available in FUNCTIONS.md.

DISCLAIMER: This is not an official Google product.

Setup

Install Google Cloud SDK

  • Install the gcloud command here
  • Install the functions local emulator here to enable local testing
  • Make sure your project is set correctly gcloud config get-value project.

Install global requirements

  • Install ImageMagick: brew install imagemagick

Install npm dependencies

  • cd serverless-cloud-maker-next-18 && npm install

Organization

  • index.js implements the main handler function
  • example_request.json shows an example of a request that the handler expects
  • example_response.json shows an example of a response that the hander returns
  • functions directory contains all of the functions, one per sub-directory

Developing Locally

  • Start the emulator functions start
  • Deploy the handler to emulator the functions deploy handler --trigger-http
  • Call the function with a test request stored in request.json: functions call handler --data="$(cat request.json)"
  • Read the logs functions logs read --limit=10

Running tests

  • Run Jest: jest (or npm run test)
  • Run Jest in watch mode: jest --watch

Deploying to GCF

(All emulator commands can be prefixed with gcloud and exhibit the same behavior)

  • Deploy the handler (1-2m): gcloud functions deploy handler --trigger-http
  • Call the handler: gcloud functions call handler --data=$(cat request.json)
  • Read the logs: gcloud functions logs read --limit=10

Upload emojis

  • Run node uploadEmojis.js to create the emoji buckets and upload the asset files to the correct location within them.

serverless-cloud-maker-next-18's People

Contributors

gakeseaton avatar jakeseaton avatar marcusguttenplan 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.