Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of usage of Yancy::Plugin::Editor::route - URL customization #90

Closed
pavelsr opened this issue Apr 6, 2020 · 2 comments
Closed

Comments

@pavelsr
Copy link

pavelsr commented Apr 6, 2020

Hi Doug,

Could you please provide an example of usage route config param?

My purpose is to customize URL - set /admin instead of /yancy.

I don't understand how it's possible to do with config - seems like Yancy::Plugin::Editor code expect Mojolicious::Routes::Route object, not a string.

If I set route => 'admin' or route => '/admin' I get Can't locate object method "to" via package ".admin" error

Setting app->routes->any( '/admin' )->name('admin'); gives same error.

@preaction
Copy link
Owner

Ah, yes, there should be an example there. Also, it could see if it got a string and make the right route for you. But, here's how it works:

sub startup( $app ) {
    my $route = $app->routes->any( '/admin' );
    $app->plugin( Yancy => {
        ...
        editor => {
            route => $route,
        },
    } );
}

So it's not possible using the standalone yancy command just yet.

@pavelsr
Copy link
Author

pavelsr commented Apr 6, 2020

Ok, got it. So for now it's impossible to customize URL just by string in config, need to redefine it in startup.

@pavelsr pavelsr closed this as completed Apr 6, 2020
preaction added a commit that referenced this issue Apr 7, 2020
This makes it a bit easier to configure routes.

Fixes #90
preaction added a commit that referenced this issue Apr 7, 2020
    [Added]

    - Added the ability for any "route" configuration to be a string.
      These will automatically be made into routes for you. Thanks
      @pavelsr for the suggestion! [Github #90]
    - Added "yancy.auth.logout" helper and route so that any authed user
      can be cleared out from any auth plugin. Thanks @pavelsr for the
      suggestion! [Github #91]

    [Fixed]

    - Fixed a bunch of missing/broken documentation (found by @pavelsr
      in #90, #91, and #92)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants