File tree 5 files changed +90
-0
lines changed
google-ruby-simple-http-endpoint
5 files changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ source "https://rubygems.org"
2
+
3
+ ffargs =
4
+ if ::File . directory? "vendor/functions_framework"
5
+ { path : "vendor/functions_framework" }
6
+ else
7
+ { }
8
+ end
9
+
10
+ gem "functions_framework" , **ffargs
Original file line number Diff line number Diff line change
1
+ <!--
2
+ title: 'GCF Simple HTTP Endpoint example in Ruby'
3
+ description: This example demonstrates how to setup a simple Ruby HTTP GET endpoint on GCP Cloud Functions.
4
+ layout: Doc
5
+ framework: v1
6
+ platform: 'Google Cloud'
7
+ language: Ruby
8
+ priority: 10
9
+ authorLink: 'https://github.com/colemanja91'
10
+ authorName: 'Allie Coleman'
11
+ authorAvatar: 'https://avatars.githubusercontent.com/u/2940547?v=4s=140'
12
+ -->
13
+
14
+ # Simple HTTP Endpoint Example
15
+
16
+ This example demonstrates how to setup a simple Ruby HTTP GET endpoint.
17
+
18
+ ## Use Cases
19
+
20
+ - Wrapping an existing internal or external endpoint/service
21
+
22
+ ## Development
23
+
24
+ The GCF Ruby environment has the following requirements:
25
+ - The code to be invoked must be defined in the ` app.rb ` file using ` FunctionsFramework `
26
+ - Any dependencies must be specified in the ` Gemfile `
27
+
28
+ https://cloud.google.com/functions/docs/concepts/ruby-runtime
29
+ https://github.com/GoogleCloudPlatform/functions-framework-ruby
30
+
31
+ ## Deploy
32
+
33
+ Run the following to deploy:
34
+
35
+ ``` bash
36
+ serverless deploy
37
+ ```
Original file line number Diff line number Diff line change
1
+ # app.rb
2
+ require "functions_framework"
3
+
4
+ FunctionsFramework . http ( "hello" ) do |request |
5
+ "Hello, world!\n "
6
+ end
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " google-ruby-simple-http-endpoint" ,
3
+ "version" : " 0.0.1" ,
4
+ "description" : " Example demonstrates how to setup a simple HTTP GET endpoint with Ruby" ,
5
+ "author" :
" Allie Coleman <[email protected] >" ,
6
+ "license" : " MIT" ,
7
+ "scripts" : {
8
+ "test" : " echo \" Error: no test specified\" && exit 1"
9
+ },
10
+ "devDependencies" : {
11
+ "serverless-google-cloudfunctions" : " ^4.5.0"
12
+ }
13
+ }
Original file line number Diff line number Diff line change
1
+ service : ruby-simple-http-endpoint
2
+
3
+ frameworkVersion : " >=2.70.0"
4
+
5
+ package :
6
+ exclude :
7
+ - node_modules/**
8
+ - .gitignore
9
+ - .git/**
10
+
11
+ plugins :
12
+ - serverless-google-cloudfunctions
13
+
14
+ provider :
15
+ name : google
16
+ runtime : ruby27
17
+ project : l<projectname>
18
+ credentials : ~/.config/gcloud/creds.json # path must be absolute
19
+
20
+ functions :
21
+ simpleGet :
22
+ handler : hello
23
+ events :
24
+ - http : path
You can’t perform that action at this time.
0 commit comments