Skip to content

Email address in URL #30

@Dam-Buty

Description

@Dam-Buty

First of all, thanks for node-simple-router, it is my GOTO router whenever i need to spin up a quick node API server. The minimalist community thanks you dearly :D

I've recently come to a project where i can possibly have an email address in a part of the URL : http://someserver.co/endpoint/test@gmail.com/action . Unfortunately this is not allowed by the default regex in router.coffee.

After a bit of fiddling around in the code, i found that regex is actually exposed as an option, so i just initialized my router with :

const router = new Router({
  regex: "/([A-Za-z0-9_\\-\\.@]+)"
})

Nothing ground-breaking but i figured it might be worthwhile to either change the default regex (although there might be some unintended side-effects - i'll let you be the judge of that), or at the very least document regex in the README. I am more than willing to propose a PR depending on what choice you land on.

Cheers,
DAM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions