Example app structure. round 1.

This commit is contained in:
Travis Reeder
2017-09-14 16:09:28 -07:00
parent fdc3e76359
commit 75e2051169
25 changed files with 194 additions and 3 deletions

25
examples/app/ruby/func.rb Normal file
View File

@@ -0,0 +1,25 @@
require 'uri'
require 'net/http'
require 'json'
name = "I love rubies"
payload = STDIN.read
if payload != ""
payload = JSON.parse(payload)
name = payload['name']
end
def open(url)
Net::HTTP.get(URI.parse(url))
end
h = "docker.for.mac.localhost" # ENV['HOSTNAME']
header = open("http://#{h}:8080/r/#{ENV['FN_APP_NAME']}/header") # todo: grab env vars to construct this
puts header
puts "Hello, #{name}! YOOO"
footer = open("http://#{h}:8080/r/#{ENV['FN_APP_NAME']}/footer") # todo: grab env vars to construct this
puts footer