B4J Question [BANano] How to setup BANanoRouter?

Toky Olivier

Active Member
Licensed User
Longtime User
Hello,
Just tried to setup a BANano sample project (zip file: ) using BANanoRouter and it seems not working for me.

I have 2 classes "Login" and "Admin" and in the main I initialized like in the tutorial
B4X:
Sub BANano_Ready()
    ' Initialize your local browser database
    ' SQL.OpenWait("SQL", "MyDB")
    ' SQL.ExecuteWait("CREATE TABLE IF NOT EXISTS tTable (tblid INT, tblcode STRING, tbldesc STRING)", Null)
    
    Router.Initialize("/vkpae", False)
    Router.AddRoute("/login", "Login", Null, False)
    Router.AddRoute("/admin", "Admin", Null, False)
    
    Router.Start("/login")
    
End Sub

But when running my project, there is an error:
B4X:
Uncaught (in promise) ReferenceError: banano_vkpae_login is not defined
    at banano_vkpae.banano_ready (app1646481295754.js:6:173)
    at HTMLDocument.BANLoadChecker (app1646481295754.js:6:1596)
 

alwaysbusy

Expert
Licensed User
Longtime User
It looks like there is a bug in BANano when in release mode and with BANano.TranspilerOptions.RemoveDeadCode = True. The Login and Admin classes are removed. So for the moment, comment out this line.

Also, BANanoRouter is a 'virtual router' so you either use:

B4X:
http://localhost ' which will jump to your startPage /login

or with hashing:

B4X:
http://127.0.0.1:8080/#/vkpae ' note the #
' or
http://127.0.0.1:8080/#/vkpae/login ' note the #

Alwaysbusy
 
Upvote 0
Top