Git Product home page Git Product logo

Comments (8)

fridays avatar fridays commented on May 18, 2024

Hey, I can't find next-routes in that project, can you post the configuration here?

If a path can't be matched by next-routes, it simply passes the request to the default handler, so it should work fine.

from next-routes.

sedubois avatar sedubois commented on May 18, 2024

Sorry forgot to git push 😄 it's there now.

from next-routes.

fridays avatar fridays commented on May 18, 2024

Ah that's because you use a catchall route, it routes everything to the profile page.

If you want some paths not handled by it, add them before:

routes.add('about', '/about');
routes.add('profile', '/:slug');

from next-routes.

sedubois avatar sedubois commented on May 18, 2024

Hmm yes that's unavoidable I guess. Thanks 🙏

from next-routes.

sedubois avatar sedubois commented on May 18, 2024

Could the API be maybe simplified to accept routes.add('about')? And the second argument pathname would be derived from the first if not provided.

from next-routes.

sedubois avatar sedubois commented on May 18, 2024

And even better, accepting an array for the first argument:

routes.add([
  'about',
  'discover'
]);

or routes.addAll

from next-routes.

fridays avatar fridays commented on May 18, 2024

Could the API be maybe simplified to accept routes.add('about')

Good idea! 👍

You can now do that when you npm update

Also you can do chaining:

routes
  .add('about')
  .add('discover')
  .add('blog', '/:slug')

from next-routes.

sedubois avatar sedubois commented on May 18, 2024

Thanks, works 👍

from next-routes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.