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

A way to just obtain a route's URL without invoking it #122

Open
kevinresol opened this issue Mar 22, 2021 · 0 comments
Open

A way to just obtain a route's URL without invoking it #122

kevinresol opened this issue Mar 22, 2021 · 0 comments

Comments

@kevinresol
Copy link
Member

Given:

interface Images {
  @:get('/$filename')
  function ofFilename(filename:String):RealSource;
}

For example, on client side we may want to do something like this:

<img src=${remote.images.ofFilename('foo.jpg').asUrl()}/>

in that case we just want the URL but not actually fetch it (because the img tag will).

or on server side we may want to perform redirection:

interface Redirected {
  @:get('/$filename')
  function ofFilename(filename:String):Url {
    return new Image().ofFilename(filename).asUrl(BASE_URL);
  }
}
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

1 participant