title: Dart redstone web application
body: <p>Let's say I configure redstone as follows</p>
  
  
  
  <pre class="lang-dart prettyprint-override"><code>    @app.Route("/raw/user/:id", methods: const [app.GET])
      getRawUser(int id) =&gt; json_about_user_id;
  </code></pre>
  
  <p>When I run the server and go to <code>/raw/user/10</code> I get raw json data in a form of a string.</p>
  
  <p>Now I would like to be able to go to, say, <code>/user/10</code> and get a nice representation of this json I get from <code>/raw/user/10</code>.</p>
  
  <p>Solutions that come to my mind are as follows:</p>
  
  <ol>
  <li>First
  <ul>
  <li>create <code>web/user/user.html</code> and <code>web/user/user.dart</code>, configure the latter to run when <code>index.html</code> is accessed</li>
  <li>in <code>user.dart</code> monitor query parameters (<code>user.dart?id=10</code>), make appropriate requests and present everything in <code>user.html</code>, i.e. </li>
  </ul></li>
  </ol>
  
  
  
  <pre class="lang-dart prettyprint-override"><code>         var uri = Uri.parse( window.location.href );
           String id = uri.queryParameters['id'];
           new HttpRequest().getString(new Uri.http(SERVER,'/raw/user/${id}').toString() ).then( presentation )
  </code></pre>
  
  <p>A downside of this solution is that I do not achieve <code>/user/10</code>-like urls at all.</p>
  
  <ol start="2">
  <li><p>Another way is to additionally configure redstone as follows:
  </p>
  
  <pre class="lang-dart prettyprint-override"><code>@app.Route("/user/:id", methods: const [app.GET])
  getUser(int id) =&gt; app.redirect('/person/index.html?id=${id}');
  </code></pre></li>
  </ol>
  
  <p>in this case at least urls like "/user/10" are allowed, but this simply does not work.</p>
  
  <p>How would I do that correctly? Example of a web app on redstone's git is, to my mind, cryptic and involved.</p>
  
  <p>I am not sure whether this have to be explained with connection to redstone or dart only, but I cannot find anything related.</p>