962 B
Vendored
962 B
Vendored
Make a Ruby function a service with fx
Write a function like,
def fx(ctx)
ctx[:response].body = "hello world"
end
then deploy it with fx up command,
$ fx up -p 8080:3000 func.rb
test it using curl
$ curl 127.0.0.1:8080
HTTP/1.1 200 Created
Connection: Keep-Alive
Content-Length: 11
Content-Type: text/html;charset=utf-8
Date: Thu, 08 Aug 2019 02:39:55 GMT
Server: WEBrick/1.4.2 (Ruby/2.6.3/2019-04-16)
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
hello world
ctx
The ctx object is a Hash have contains request, response, status, and headers of Sinatra