Masonite Inertia
4.X
4.X
  • Introduction
  • Installation
  • Demo app
  • The basics
    • Routing
    • Responses
    • Redirects
    • Validation
    • Shared data
    • File uploads
  • Advanced
    • Configuration
    • Root view
    • Partial reloads
    • Authorization
    • CSRF protection
    • Error handling
    • Assets versioning
    • Server-side rendering
    • Testing
  • Development
    • Changelog
    • Contribute
    • Support
Powered by GitBook
On this page
  1. Advanced

Configuration

Via the configuration file and/or a custom middleware.

PreviousFile uploadsNextRoot view

Last updated 3 years ago

Was this helpful?

CtrlK
  • Configuration file
  • Overriding Middleware

Was this helpful?

Configuration file

The package can be globally configured via config/inertia.py configuration file.

Variable
Description

PUBLIC_PATH

Absolute path to mix-manifest.json location. It's needed for computing js assets version.

Default: project root

ROOT_VIEW

Global root template view used by your Inertia Controllers to render the page. Specify the name of the view without .html. See .

Default: "app"

INCLUDE_ROUTES

Include server-side routes as JSON payload in Inertia response (as a prop). See .

Default: False

Overriding Middleware

The `InertiaMiddleware` can be overriden to define the root view and the way assets version is computed. You just have to create a middleware in your app inheriting from the `InertiaMiddleware` class.

app/http/middleware/HandleInertiaRequests.py
from masonite.inertia import InertiaMiddleware

class HandleInertiaRequests(InertiaMiddleware):
    
    root_view = "other_app"
    
    def 

Then include this middleware in the HTTP middleware instead of the original one.

version
(
self
,
request
):
return "123"
Root view
routing