I added a custom module to Luci following the guide below.
Everything works fine. The only problem is the menu item I added is visible even when logged out. However when I click the menu the login prompt is shown as expected as the module is under the admin path. All other built-in menus like Status, System, Network, etc. stay hidden when logged-out. I would like my custom menu item also to be only visible when logged in.
I remember reading the document which described how to control visibility of nodes to non-logged users, but I've just tried to find it again and couldn't.
Have you checked all the other controller files for clues?
As I haven't installed any apps the only other controller present is the main admin controller, which has only two files 'index.lua' and 'uci.lua'. Those files do not have an index() function.