Class: Jax::Server
- Inherits:
-
Rails::Server
- Object
- Rails::Server
- Jax::Server
- Defined in:
- lib/jax/server.rb
Overview
The server is just a bare-bones Rails application built into the Jax gem. It mounts Jax::Engine at the root path.
The server can be run from any Jax application by simply executing the ‘jax server` command.
Note: in a Rails app, you should simply mount Jax::Engine directly in your ‘config/routes.rb` file:
Rails.application.routes.draw do
mount Jax::Engine => "/jax" if Rails.env != "production"
end
The above example will mount the Jax development suite in development and test modes, but not in production mode. Usually, you won’t want to expose Jax::Engine to a production environment, but of course this is up to you.
Note that you only need to mount Jax::Engine if you want to use the development suite. You get the Jax assets (e.g. the Jax JavaScript API) for free when you add Jax to your Gemfile.
Executing ‘jax server` in a Rails application is equivalent to executing `rails server`.
Defined Under Namespace
Classes: Options
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Server
constructor
A new instance of Server.
- #middleware ⇒ Object
- #opt_parser ⇒ Object
- #options ⇒ Object
Constructor Details
#initialize(*args) ⇒ Server
Returns a new instance of Server.
70 71 72 73 |
# File 'lib/jax/server.rb', line 70 def initialize(*args) @args = args super() end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
64 65 66 |
# File 'lib/jax/server.rb', line 64 def args @args end |
Instance Method Details
#middleware ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/jax/server.rb', line 75 def middleware middlewares = [] middlewares << [::Rails::Rack::LogTailer, log_path] unless [:daemonize] || [:quiet] middlewares << [::Rails::Rack::Debugger] if [:debugger] middlewares << [::Rack::ContentLength] Hash.new(middlewares) end |
#options ⇒ Object
83 84 85 |
# File 'lib/jax/server.rb', line 83 def @options ||= (args) end |