class
ActionController::Server
- ActionController::Server
- Reference
- Object
Included Modules
- ActionController::Router
Defined in:
action-controller/mcp/previewer.craction-controller/server.cr
Constant Summary
-
REUSE_DEFAULT =
{% if flag?(:win32) %} false {% else %} true {% end %} -
reuse port is only useful for broadcast or multicast applications on windows when used with TCP it is considered a security risk as the port can be stolen
Constructors
-
.new(port : Int32 = 3000, host : String = "127.0.0.1", reuse_port : Bool = REUSE_DEFAULT, composition : Composition = Composition.default)
create an instance of the application
-
.new(ssl_context : OpenSSL::SSL::Context::Server | Nil, port : Int32 = 3000, host : String = "127.0.0.1", reuse_port : Bool = REUSE_DEFAULT, composition : Composition = Composition.default)
create an instance of the application with tls
Class Method Summary
-
.after(*handlers)
handlers to run after your application code, see: handlers
-
.before(*handlers)
handlers to run before your application code, see: handlers
-
.print_routes
Used to output route details to the console from a command line switch
-
.routes : Array(Tuple(String, Symbol, Symbol, String))
returns a list of the routes defined in the application
Macro Summary
-
compose(*roots)
Select application roots for routing, route listing and generated catalogs.
Instance Method Summary
-
#close : Nil
Terminates the application gracefully once any cluster processes have exited
-
#cluster(count, short_arg, long_arg, args = ARGV.dup)
Launches additional worker processes removing the short and long arguments that trigger this method
-
#cluster(count)
Spawns
countnumber of threads in the default Fiber::ExecutionContextDEPRECATED Use
#threadsinstead - #composition : Composition
-
#host : String
the host address the server is configured to run on
-
#mount_mcp_card_previewer(path : String = "/mcp/card/preview", mcp : String | Nil = nil) : ActionController::MCPServer::CardPreviewer
mounts the MCP Apps card previewer, see
ActionController::MCPServer.mount_card_previewer. -
#port : Int32
the port the server is accepting connections from
-
#print_addresses
Prints the addresses that the server is listening on
-
#run(&) : Nil
Starts the server, providing a callback once the ports are bound
-
#run : Nil
Starts the server
-
#socket : HTTP::Server
Provides access the HTTP server for the purpose of binding For example
server.socket.bind_unix "/tmp/my-socket.sock" -
#threads(count = -1)
Spawns
countnumber of threads in the default Fiber::ExecutionContext
Instance methods inherited from module ActionController::Router
compile_routes : Nil
compile_routes,
delete(path : String, &block : Action)
delete,
get(path : String, &block : Action)
get,
head(path : String, &block : Action)
head,
options(path : String, &block : Action)
options,
patch(path : String, &block : Action)
patch,
post(path : String, &block : Action)
post,
put(path : String, &block : Action)
put,
route_handler : RouteHandler
route_handler
Constructor Detail
create an instance of the application
create an instance of the application with tls
Class Method Detail
handlers to run after your application code, see: handlers
these will only be run if the route is not found in your application
handlers to run before your application code, see: handlers
configure these in your config.cr file
returns a list of the routes defined in the application
responds with [{"ControllerClass", :name, :verb, "/route"}]
Macro Detail
Select application roots for routing, route listing and generated catalogs. Call from config.cr before constructing the server.
Instance Method Detail
Launches additional worker processes removing the short and long arguments that trigger this method
Spawns count number of threads in the default Fiber::ExecutionContext
DEPRECATED Use #threads instead
mounts the MCP Apps card previewer, see ActionController::MCPServer.mount_card_previewer.
Call it once the MCP server is mounted, from the #run callback or before #run
server.run do
server.mount_mcp_card_previewer("/mcp/card/preview")
end
Provides access the HTTP server for the purpose of binding
For example server.socket.bind_unix "/tmp/my-socket.sock"