Configuring Routes
Martini Webpage Template Routes
In Martini, linking a Web Page template to a specific path is efficiently achieved by configuring a route. This can be done within the Web Page template editor, particularly through the Route tab in the Properties view.
Accessing Your Template
Once a route is configured, the template becomes accessible under the base path /app. For instance, if you assign the route /todo to a template, it can be accessed at http://{host}:{port}/app/todo.
Configuration Steps
-
Open the Web Page Template: Begin by opening the template you wish to expose.
-
Access Properties View: Click the table icon in the toolbar to display the Properties view, typically situated on the right side of your screen.
-
Navigate to the Route Tab: In the Properties view, select the Route tab.
-
Select HTTP Method(s): Choose the appropriate HTTP method(s) for your web content. Commonly,
GETis used for data requests, whilePOSTis utilized for submitting data, such as in forms. -
Set Request Body (For
POSTMethod): IfPOSTis selected, specify the request body. This can be any of the template's inputs, chosen via the Body Parameter dropdown. -
Define the URL Path: Specify the URL path where your web content will be accessible. Path parameters can be included by enclosing them in braces
{}. Martini will automatically map these to any Gloop template input property with the same name, excluding properties that are models or objects. -
Save Changes: Apply the changes by pressing
Ctrl+S(orCmd+Son macOS). The route will be active shortly after your instance registers the template's route, which usually takes a few seconds.