Coder Social home page Coder Social logo

Request matchPath('*') about marble HOT 8 CLOSED

marblejs avatar marblejs commented on May 22, 2024
Request matchPath('*')

from marble.

Comments (8)

nairihar avatar nairihar commented on May 22, 2024 1

Also I think will be cool to handle routes with matchPath using regex.

from marble.

JozefFlakus avatar JozefFlakus commented on May 22, 2024 1

@couzic but why would we need a second layer for processing outgoing requests? The end of the request lifecycle should be visible inside Effect pipeline which is then processed by the responseHandler. If there would be some need for applying some transformations for sent data then you can simply use use operator for composing it just before final map.

But definitely the custom error.handlers should have an ability to intercept 404 responses in case when no Effect will match the request.

from marble.

JozefFlakus avatar JozefFlakus commented on May 22, 2024

Can you post here some code samples for use cases?
Right now if Effect doesn't compose matchPath operator it behaves like matchPath('*') - it handles all requests in his group. In my opinion adding custom matcher like this can be redundant and will obfuscate the matchPath logic. But if there are some other use cases that we are not aware of we can think about this idea.

from marble.

nairihar avatar nairihar commented on May 22, 2024

In Marble If we want to handle routes which has 404 status (not found that path) how we can do that ?
As I understood from source code we can't.

Also we can add some "not handled error" Observable where user can subscribe and do some work for that error.

from marble.

couzic avatar couzic commented on May 22, 2024

This thread makes me think. Currently, middlewares handle incoming requests, would it make sense to have a second group of middlewares that handle outgoing responses ? Or instead of incoming/outgoing, it could be beforeEffects/afterEffects.
It would provide easy solutions for cases like handling all 404 responses.

from marble.

JozefFlakus avatar JozefFlakus commented on May 22, 2024

@nairihar * matching added in version 0.4.0. You can see the latest changelog here: marblejs.gitbook.io/marble/changelog1

from marble.

JozefFlakus avatar JozefFlakus commented on May 22, 2024

@nairihar here you can find an example implementation for 404 route detection.

In the next days I will update the marblejs.com with detailed description how routing is resolved (introduced in #40).

from marble.

couzic avatar couzic commented on May 22, 2024

@JozefFlakus I agree with you, it was just a naive thought. The * solution works for me !

from marble.

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.