Difference between revisions of "Dev Tools/lookup-routing"

From Dreamwidth Notes
Redirect page
Jump to: navigation, search
(initial information)
 
(This tool's in the official repo now.)
 
Line 1: Line 1:
Easy way to look up which controller handles a given URL. Also lets you list the current contents of the routing table, and overall controller stats.
+
#REDIRECT [[Routing and Template Cookbook: Find the handler for a URL]]
 
+
Three main modes:
+
== Path => Controller mapping ==
+
 
+
  lookup-routing /nav/create
+
 
+
Results:
+
  app: /nav/create is defined in the file cgi-bin/DW/Controller/Nav.pm,
+
    and using the handler sub nav_handler
+
 
+
 
+
More detailed information can be obtained using the --verbose switch
+
 
+
  lookup-routing --verbose /nav/create
+
 
+
Results:
+
  app: /nav/create is defined in the file /mnt/hgfs/dw/cgi-bin/DW/Controller/Nav.pm,
+
    and using the handler sub nav_handler
+
  * Default Format: html
+
  * Enabled for formats: html, json
+
  * Enabled For: app
+
  * Regex: (?-xism:^/nav(?:/([a-z]*))?$)
+
  * Matched Subpatterns:
+
        'create'
+
 
+
== List of contents of the routing table ==
+
 
+
  lookup-routing --list # everything in the routing table
+
 
+
Results:
+
  app: /__rpc_cuttag is defined in the file cgi-bin/DW/Controller/RPC/CutExpander.pm,
+
    and using the handler sub cutexpander_handler
+
  app: /about is a controller-less template: views/misc/about.tt
+
    * Defined in cgi-bin/DW/Controller/Dreamwidth/Misc.pm
+
  app: /admin is a redirect to /admin/
+
  app: /admin/ is defined in the file cgi-bin/DW/Controller/Admin.pm, and using the
+
    handler sub admin_handler
+
  ...
+
  app: /post/(\d+) is defined in the file cgi-bin/DW/Controller/Post.pm, and using the
+
      handler sub edit_handler
+
  ...
+
 
+
 
+
  # filter to just those that use regex matching and are in user-space
+
  # (e.g., http://$username.dreamwidth.org/ vs.
+
  lookup-routing --list --regex --user http://www.dreamwidth.org)
+
 
+
Results:
+
  # same as above but with more targeted results
+
 
+
== Summary /stats ==
+
 
+
  lookup-routing --stats
+
 
+
Results:
+
  String routing table:
+
      48 - app
+
      5 - user
+
      53 - TOTAL
+
  Regex routing table:
+
      4 - app
+
      1 - user
+
      5 - TOTAL
+
  Total entries: 58
+
 
+
 
+
+
 
+
See lookup-routing --help --verbose for more detailed and updated documentation.
+

Latest revision as of 21:52, 1 August 2013