-
Notifications
You must be signed in to change notification settings - Fork 0
Initialization
Lars Olsson edited this page Dec 6, 2015
·
1 revision
This is a high level overview of how a Racket application is initialized. This page i a work in progress, Racket has changed its Initialization process several times already. However, from version 0.4 onward, I am planning on having a more stable initialization process, so if you are use a Racket version newer than that you may rely on the information on this page being accurate.
- Racket is invoked using either
Racket::Application#defaultorRacket::Application#using -
Racket::Application#initis the main entry point for Racket::Application. It takes one parameter, settings, which is a hash containing all configuration that is needed for starting the Racket application. - A
Racket::Settings::Applicationobject is created to hold settings for the current application. -
Racket::Application#applicationis called to make sure all middleware and all default helper modules are loaded. After this step, Racket will be able to find all plugins and helpers without requiring them again. -
Racket::Application#setup_static_serveris called. If the configuration option:public_diris a string, this step will set up aRack::Filehandler for the public directory, otherwise this step will do nothing. - A
Racket::Routerobject is created to hold routes in the application. - Controllers are loaded by calling
Racket::Application#load_controllers. This involves three steps: 1. Controller class is loaded. 2. Controller class is added to the list of routes held by the router object. 3. Helpers (both default and specific to the controller) are included in the controller class.