That create(nil) is indeed impossible to make it work correctly.
The proper approach is to create a GUI application that contains the webserver, not the other way around.
Your approach is simply wrong.
The GUI application can of course be hidden and running in the background. Use a hotkey to make it visible/hidden.
Another approach is to write a service or daemon as the webserver and a controller as a GUI app that communicates with the service/daemon.
Note: if you misuse the visual component as an ordinary tree (not visible), use an ordinary tree instead. (I have seen that happen!, wrong approach)
Note2: if it is your intention to serve a treeview, use a javascript component instead. You can Pascalize that with pas2js.