Giter Club home page Giter Club logo

Comments (2)

kartikk221 avatar kartikk221 commented on June 19, 2024 1

Hey, there currently isn't support for that specific syntax since hyper-express for the most part, passes the path straight to uWS.js which has a fast router for working with path parameters. This can certainly be implemented in the future as a breaking change during a major version upgrade.

With that said, what you are trying to achieve can be done with wildcards like so:

router.get('/get-message/*', (request: Request, response: Response) => {
   // When splitting the path by slashes, the first item will be "get-message", second and third would be the optional params
   const [_, session_id, timestamp_before] = request.path.split('/');
});

Keep in mind, wildcard routes effectively listen for all subpaths on the wildcard, so you should bind the wildcard route last.
So the above example would handle all requests whose paths begin with "/get-message/....." so be mindful of that.

from hyper-express.

arunnabraham avatar arunnabraham commented on June 19, 2024 1

Thanks @kartikk221, I will consider that solution for now.

from hyper-express.

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.