ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

commit ffdc82cb85188611b4054cbb2a17590dc9546e42
parent d53ea89ce3f9d596410d49e0212fbf4fd0848594
Author: Adem Gaygusuz <adem@ardweb.co.uk>
Date:   Tue,  8 Sep 2015 13:35:27 +0100

Fixed parameterized route example
Diffstat:
Mdocs/recipes/how-to-implement-routing.md | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/recipes/how-to-implement-routing.md b/docs/recipes/how-to-implement-routing.md @@ -86,7 +86,7 @@ window.addEventListener('hashchange', () => render()); render(); ``` -### Step 3: Parametrized Routes +### Step 3: Parameterized Routes **(1)** Convert the list of routes from hash table to an array, this way the order of routes will be preserved. **(2)** Wrap this collection into a Router @@ -109,8 +109,8 @@ const router = new Router(on => { const data = await http.get('/api/products'); return <Layout><ProductListing {...data} /></Layout> }); - on('/products/:id', async (id) => { - const data = await http.get(`/api/products/${id}`); + on('/products/:id', async (req) => { + const data = await http.get(`/api/products/${req.params.id}`); return <Layout><ProductInfo {...data} /></Layout>; }); }]);