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.

Is there a way to support dynamic routes?

Something like:

server.route({
  method: 'GET',
  path: '/v2/users/{userId}/books',
  handler: (req, h) => {...}
})

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
sholladaycommented, Sep 20, 2019

I added an improved router in https://github.com/sholladay/pogo/commit/9352e7905e95c5790d5f5f6944bc7bd0d9f4e4b2 and https://github.com/sholladay/pogo/commit/b661df64ae2dab0ae9528ae40fe6bf2dc2e92ef4, which brings support for:

  • Simple path parameters of the {userId} variety (required params)
  • Wildcard method handlers (method: '*' in route config)
  • server.inject() to make a request directly to the server without using the network (useful when writing tests)

There are still many improvements that should be made to the router. Among them, optional params and params that cover part of a segment or multiple segments are not yet supported. But it’s a reasonable place to start and we can deal with the rest in separate issues. Let me know how it works for you!

0reactions
sholladaycommented, Sep 28, 2019

I just published a new release with these changes, as well as other routing improvements and bugfixes.

https://github.com/sholladay/pogo/releases/tag/v0.2.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic Routes - Next.js
Dynamic Routes are pages that allow you to add custom params to your URLs. Start creating Dynamic Routes and learn more here.
Read more >
Routing in Next.js – How to Set Up Dynamic Routing with Pre ...
In this tutorial, you'll learn how to set up dynamic routing in Next.js. You'll also learn about pre-rendering and why it's important.
Read more >
Static vs. dynamic routing: What is the difference? - TechTarget
Dynamic routing, sometimes called adaptive routing, is more complex than static routing because it creates more possible routes to send packets across a ......
Read more >
How to Create Dynamic Routes in Next.js - MakeUseOf
Dynamic routes are pages that allow you to use custom parameters in a URL. They are especially beneficial when creating pages for dynamic ......
Read more >
Dynamic routing - Wikipedia
Dynamic routing, also called adaptive routing, is a process where a router can forward data via a different route for a given destination...
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