fnd, short for "function daemon", is a daemon program capable of storing and running ruby code on demand. Think of it as a dynamic API.
Consider the following Ruby code:
# say_hello.rb
"Hello #{name}"You can upload it to the fnd daemon by running:
$ fn upload say_hello.rb --to localhost:8080Once uploaded, the daemon loads your code and hosts it through a HTTP API. For instance, you can invoke it from the command-line with:
$ curl -d "{\"name\":\"fnd\"}" http://localhost:8080/say_hello -H "Content-type: application/json"
Hello fnd$ gem install fndAlternatively use our Docker image dieb/fnd:
$ docker pull dieb/fndRun the fnd daemon:
$ fnd
[2015-01-04 01:04:55] INFO WEBrick 1.3.1
[2015-01-04 01:04:55] INFO ruby 2.0.0 (2014-01-12) [x86_64-linux-gnu]
[2015-01-04 01:04:55] INFO WEBrick::HTTPServer#start: pid=1 port=8080Or if you prefer through Docker:
$ docker run --rm -ti -p 8080:8080 dieb/fnd
[2015-01-04 01:04:55] INFO WEBrick 1.3.1
[2015-01-04 01:04:55] INFO ruby 2.0.0 (2014-01-12) [x86_64-linux-gnu]
[2015-01-04 01:04:55] INFO WEBrick::HTTPServer#start: pid=1 port=8080MIT License. See LICENSE for details.
Copyright (c) 2014-2015 André Dieb Martins