question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A way to build a URL route

See original GitHub issue

Hello!

I have a service with eight http endpoints and i need to build urls for it with multiple different parameters. Are there any way to implement something like url_for in flask:

Example:

class Service:
    @http('GET', '/url-one/<token>')
    def handle_url_one(self, request, token):
        pass
    
    @rpc
    def get_url_one(self):
        return '/url-one/' + token   # This is not DRY and error-prone approach
        # Wanted: return self.url_for(self.handle_url_one, token)

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asynceecommented, May 23, 2018

I have created basic implementation. Check it out: https://gist.github.com/asyncee/afff12559e364b0665c89b0e53341c28

0reactions
mattbennettcommented, Aug 13, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to: Construct a URL from a Route | Microsoft Learn
To create a URL ... Call the GetVirtualPath method of the RouteCollection class and pass the RouteValueDictionary object to construct the URL. To ......
Read more >
java - Is there a right way to build a URL? - Stack Overflow
You can use Apache URIBuilder. Sample code: Full Apache Example URIBuilder builder = new URIBuilder() .setScheme("http") .setHost("apache.org") .
Read more >
URLs and Routing - Meteor Guide
In a web application, routing is the process of using URLs to drive the user interface (UI). URLs are a prominent feature in...
Read more >
How to Build a Simple Router in JavaScript using Window ...
A router watches for changes in the URL and calls the appropriate function. The method is then responsible for rendering the view.
Read more >
Six Factors for Better URL Path Design in Web Apps
1. Dealing with Public and Private URL Paths · 2. Deciding When to Use Paths and Parameters to Store Application State · 3....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found