Thank you for all of the input, this suggestion is basically the solution I 
arrived at on my own:

MyApp::Admin::add_routes(app);

Not everyone's cup of tea, but I love the flexibility.

Thank you!

V

On Monday, April 29, 2019 at 3:17:18 PM UTC-7, Dan Book wrote:
>
> No, the Lite DSL can only be imported into one "app" script for the "app". 
> However, you could call a function and pass it `app` or `app->routes` to 
> add routes to like a full app would.
>
> -Dan
>
> On Mon, Apr 29, 2019 at 2:15 PM Viktor Nacht <vikto...@gmail.com 
> <javascript:>> wrote:
>
>> I have a fairly simple Mojo app where I just want to spin off the admin 
>> routes into a module but still use the Mojolicious::Lite syntax. I 
>> understand I could "grow" the app, but that would add a lot of extra files 
>> where I really just need to add one file. 
>>
>> Is something like this possible? I tried the "obvious" approach but no 
>> luck.
>>
>> use Mojolicious::Lite;
>> use MyApp::Admin;
>>
>> get '/public'
>>
>> app->start;
>>
>> package MyApp::Admin;
>>
>> use Mojolicious::Lite;
>>
>> get '/admin';
>>
>> The route /admin isn't added even though the module is found and 
>> processed (using FindBin). Any thoughts?
>>
>> Thank you!
>>
>> V
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mojolicious" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to mojol...@googlegroups.com <javascript:>.
>> To post to this group, send email to mojol...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/mojolicious.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to