B4J Tutorial [Web] EndsMeet Server (Getting Started)

You can download the project template from:

Steps:
  1. Just drop the template into B4J additional libraries folder.
  2. Open B4J IDE and create a new project.
  3. Recommended: Use LibDownloader to download the dependencies.
  4. The starter template is now ready to use.

Enable home or index page
  1. The following code add a GET route to load the index page.
    B4X:
    app.Get("", "Index")
Enable POST method or route
  1. The following code add a POST route
    B4X:
    app.Post("/modal", "Index")
  2. Take note that in Index.bas (GenerateIndex sub), we use HTMX hx-post instead of hx-get
    B4X:
    Button.attribute2(CreateMap("hx-post": "/modal", _
    "hx-target": "#modals-here", _
    "hx-trigger": "click", _
    "data-bs-toggle": "modal", _
    "data-bs-target": "#modals-here", _
    "class": "btn btn-primary text-uppercase")) _
    .Text("Open Modal").up(div2).uniline
  3. You will see a "405 Method Not Allowed" page if you try to browse the page (GET method)
Happy developing your web application!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…