Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register routes refactoring #90

Open
pchalupa opened this issue Jan 25, 2021 · 0 comments
Open

Register routes refactoring #90

pchalupa opened this issue Jan 25, 2021 · 0 comments
Labels
refactoring Something needs to be refactored.

Comments

@pchalupa
Copy link
Contributor

pchalupa commented Jan 25, 2021

Refactor register route. Remove regex string and search for improvements.
Current state:

$router->register(RouteFactory::fromConstants(1, "GET", "@^(?<version>[0-9])/gallery$@", "getAll"))
->register(RouteFactory::fromConstants(1, "GET", "@^(?<version>[0-9]+)/gallery/(?<id>[0-9]+)$@", "getOneById", array("id")))
->register(RouteFactory::fromConstants(1, "GET", "@^(?<version>[0-9]+)/gallery/(?<alias>[a-z1-9-]+)$@", "getOneByAlias", array("alias")))
->register(RouteFactory::fromConstants(1, "GET", "@^(?<version>[0-9]+)/gallery/find/(?<key>[a-z1-9-]+)/(?<value>[a-z1-9-]+)$@", "find", array("key", "value")))
->register(RouteFactory::fromConstants(1, "POST", "@^(?<version>[0-9]+)/gallery$@", "create", array(), true))
->register(RouteFactory::fromConstants(1, "PUT", "@^(?<version>[0-9]+)/gallery/(?<id>[0-9]+)$@", "edit", array("id"), true))
->register(RouteFactory::fromConstants(1, "DELETE", "@^(?<version>[0-9]+)/gallery/(?<id>[0-9]+)$@", "delete", array("id"), true));

@pchalupa pchalupa added the refactoring Something needs to be refactored. label Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Something needs to be refactored.
Projects
None yet
Development

No branches or pull requests

1 participant