-
Notifications
You must be signed in to change notification settings - Fork 216
Server
boosty edited this page Jun 16, 2011
·
7 revisions
Goliath uses its own event based server built on top of EventMachine. As shown in the example above, to start the server, you just need to have Ruby to execute your Goliath API file. The server accepts some optional parameters described below:
Server options:
-e, --environment NAME Set the execution environment (prod, dev or test) (default: development)
-a, --address HOST Bind to HOST address (default: 0.0.0.0)
-p, --port PORT Use PORT (default: 9000)
-l, --log FILE Log to file (default: off)
-s, --stdout Log to stdout (default: false)
-P, --pid FILE Pid file (default: off)
-d, --daemonize Run daemonized in the background (default: false)
-v, --verbose Enable verbose logging (default: false)
-h, --help Display help message
Note that the default environment could be set in your code using the Goliath.env= method call.
Here is an example of how to start a production Goliath API daemonized and on port 92010. If not set, the default goliath pid and log files will be used.
$ ruby awesome_api.rb -e prod -p 92010 -dThe server will automatically load the API matching the file name. If your api file is named awesome_api.rb, the server will expect that you have an AwesomeApi class inheriting from Goliath::API.