Code Monkey home page Code Monkey logo

Comments (3)

karthik2804 avatar karthik2804 commented on August 11, 2024

The router does support the match-all syntax which can be added as the last entry to catch all routes that do not match. It is how itty-router is implemented. Would that be sufficient in this case.

router.all("*", ...)

I personally think that there should be no default route handling because there are cases where I would want to use a router to be triggered only on specific routes.

from spin-js-sdk.

rylev avatar rylev commented on August 11, 2024

I suppose that would be sufficient. I simply found it surprising that the router wasn't catching unknown routes, but if we give the user a good way to do this (and display it prominently in the docs, that is probably good enough.

from spin-js-sdk.

ThorstenHans avatar ThorstenHans commented on August 11, 2024

I think there are two ways of approaching this:

  1. The Router should provide the same behavior as popular/common routers provided by other frameworks of the particular language (JS/TS here).
  2. The Router should provide the same behavior across all Spin SDKs.

Initially, I thought option 2 would be the best way to go. Option 2 would be especially useful for developers using multiple languages to craft Spin applications.

On the flip side, option 1 would smoothen the adoption for JS developers, because they expect the router to behave in a certain way.

from spin-js-sdk.

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.