Method: Mango::Application.get_all

Defined in:
lib/mango/application.rb

.get("/*") ⇒ Object

Attempts to render content page templates found within settings.content

First, the application attempts to match the URI path with a public file stored in settings.public_dir. If a public file is found, the handler will:

  • Send the public file with a 200 HTTP response code
  • Halt execution

For example:

`-- themes
    `-- default
        `-- public
            `-- hello_word.html

GET /hello_word.html => 200 themes/default/public/hello_word.html

If no match is found, the route handler attempts to match the URI path with a content page template stored in settings.content. If a content page template is found, the application will:

  • Read the content page from disk and render the data in memory
  • Render the content page's view template file (see Mango::ContentPages)
    • An exception is raised if a registered engine for the view template file cannot be found or if the view template file cannot be found within settings.views.
  • Send the rendered page with a 200 HTTP response code and halt execution

In addition, if a layout template file exists within settings.views and that layout template file shares the same file extension as the view template, then the page's view template is wrapped within this layout template when rendered.

For example, given the following mango application:

|-- content
|   `-- index.markdown
`-- themes
    `-- default
        `-- views
            |-- layout.haml
            `-- page.haml

where the index.markdown content page's view template file is page.haml, then:

GET /index => 200 content/index.markdown +
                  themes/default/views/page.haml +
                  themes/default/views/layout.haml

Finally, if no matches are found, execution is passed to the next matching route handler if one exists. Otherwise, execution is passed to the NOT_FOUND error handler.



494
495
496
497
498
# File 'lib/mango/application.rb', line 494

get "/*" do |uri_path|
  render_index_file! uri_path
  render_content_page! uri_path
  pass
end