menu

Mockoon

Mockoon's official community. Get help, discuss new features.

Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# Announcements
view-forward
# Bugs
view-forward
# Features
view-forward
# Help
view-forward
Team

I basically want to accept a route with any guid.

December 30, 2019 at 5:31pm

I basically want to accept a route with any guid.

December 30, 2019 at 5:31pm (Edited 9 months ago)
I for some reason can't get it. I've searched everywhere, I see there is limited Regex support and I can't get any standard regex to work, and I can't seem to get the hang of express string based paths...

December 30, 2019 at 5:46pm
Try the regex101.com website to test if your URL matches the route with a regex in it.
  • reply
  • like
Yea it looks fine. Mockoon passes it to the proxy though.
  • reply
  • like
  • reply
  • like
regex101
  • reply
  • like
  • reply
  • like
My endpoint
  • reply
  • like

December 31, 2019 at 8:54am
According to express js documentation, you can either use simple regex like syntax (like a dot, or a plus sign) or "real" regex patterns. But you need to wrap them in parenthesis. And the first slash must not be escaped as not part of the regex:
  • reply
  • like
orders/([0-9a-f]{8}-[0-9............-f]{12})
  • reply
  • like