To run the server from the terminal without having to write
rackup all the time, you can use shotgun, a gem that reloads the application with every request.
You can install it with the gem command:
$ gem install shotgun
To easy its usage, you just need to create a file with the name
makefile with the following content:
server: shotgun -o 0.0.0.0
It is important to use a
<tab> to indent the commands and not spaces.
Then you can run:
$ make server
This is what you get in response:
shotgun -o 0.0.0.0 == Shotgun/WEBrick on http://0.0.0.0:9393/ [2014-08-09 20:40:18] INFO WEBrick 1.3.1 [2014-08-09 20:40:18] INFO ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0] [2014-08-09 20:40:18] INFO WEBrick::HTTPServer#start: pid=23274 port=9393
Now your application lives in http://localhost:9393 and you no longer have to manually restart your server all the time.