• Home
  • Why Erstwhile?
  • Getting Started
  • Learn Erstwhile
  • API Docs
  • Home
  • Why Erstwhile?
  • Getting Started
  • Learn Erstwhile
  • API Docs
  • Learning Erstwhile
  • File Structure
  • Compilation Process
  • Routing
  • Request Flow
  • Components and ErML
    • How Components are Compiled
    • Themes
    • Layouts
  • Scoped Variables
  • Modals
  • Models
    • Using an Erstwhile-aware Backend
    • Creating Your Own Description.json
    • Using Models from the Controller

Request Flow

7 views 0

Written by mike
August 7, 2023

When the user visits a URL in their browser, an Erstwhile application goes through the following steps:

  1. Boots: This only happens when the page first loads, where the pre-compiled routes and templates are loaded into the application. Subsequent page loads use this cached information.
  2. Check the path in the routing table: The framework attempts to look up the path in the routing table. Assuming it finds it…
  3. Clears the page scope: The framework empties the page scope, getting it ready for the next page to load.
  4. Run the controller’s preAction: If one is provided.
  5. Run the specified route action: This is the big one, and can include things like the following.
    • Setting Scoped Variables needed by the view layer to properly render the page.
    • Defining event handlers that can be used within the views.
    • Handling query string arguments that can change page behavior.
    • Accessing data via the model layer to either do lookups or updating operations.
    • Registering deferred functions that need to be run after the DOM is rendered.
  6. Run the controller’s postAction: If one is provided.
  7. Renders the ErML layout: If necessary. If the layout hasn’t changed, it keeps it as is.
  8. Renders the ErML page view: Based on the controller and action name.
  9. Registers the ErstwhileComponents present in the layout and page.
  10. Initializes the ErstwhileComponents.
  11. Registers the listeners for the Scoped Variables.
  12. Runs the deferred functions.

Steps 2-13 are repeated whenever a user goes to a new URL, which typically happens through the application’s redirect() method.

Was this helpful?

Yes  No
Related Articles
  • Using Models from the Controller
  • Creating Your Own Description.json
  • Using an Erstwhile-aware Backend
  • Models
  • Modals
  • Scoped Variables

Didn't find your answer? Contact Us

Previously
Routing
Up Next
Components and ErML

loader

Join our Mailing List     

  • Privacy Policy
  • Terms of Use
  • © 2025 RestlessDev. Made in New Orleans.

Welcome to Erstwhile

Thank you for checking out Erstwhile. We’re just getting started, so if you’d like to keep up with our progress please register now and we’ll let you know when new releases come out.

loader

Email Address*

Name