Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I like to keep the URLs as logical as possible, and avoid framework-specific URLs (consider that you may change the framework in the future, which would then have to keep using your old URL patterns to avoid breaking external links.)</p> <p>Basically:</p> <pre><code># All customers: /customers/ # New customer: /customers/new /customers/?new # another version if you don't think "new" deserves its own path # Existing customer: /customers/123/ /customers/123 # another version if you want the concept that it's a page, not a # directory # Edit customer: /customers/123/edit /customers/123?edit # Some sub-list for a customer: /customers/123/orders/ # and so on... </code></pre> <p>To be honest, I personally prefer the second example in the cases where I provided two examples. It uses the concept from file systems that lists are "directories" and separate entries are "files". Every path represents some kind of data, and other paths are separated using the query string (<code>/customers/?new</code>).</p> <p>After you've decided on your URL structures, you should have a look at how to implement this in your web framework. Most frameworks I consider "good" have some kind of support for mapping URLs (usually with some kind of pattern supporting wildcards, such as regular expressions.) So your patterns might look like this, using my second examples (regex):</p> <pre><code>^/customers/$ -&gt; CustomerList ^/customers/(\d+)$ -&gt; Customer # This will check the query string for "edit" etc # to determine which mode to use. ^/customers/(\d+)/orders/$ -&gt; OrderList </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload