We want to open a DELETE
endpoint that allows calls to all positive integers, but not id 1 (aka element 1 cannot be deleted)
Usually to open an endpoint that allows positive integers I configure the route like this
delete_elements:
path: /elements/{id}
methods: ["DELETE"]
controller: app.elements_delete
requirements:
id: '\d+'
For this case I tried to change the regex to one that does not allow number 1 either
delete_elements:
path: /elements/{id}
methods: ["DELETE"]
controller: app.elements_delete
requirements:
id: /^(?!(?:1)$)\d+/
But when I modify the requirement and I call the endpoint the response is that the endpoint does not exist.
"No route found for "DELETE /elements/59": Method Not Allowed (Allow: GET, PUT)"
What is wrong with that regex? What would be the right way to forbid certain values?