Claudia API Builder allows you to intercept web API requests, filter and change them before routing. This example demonstrates how to set up a simple intercept that kills all requests without a query string name parameter.
- run
npm startto install the app - try the API
/helloURL in your browser, it should report an error - add
?name=Tomto the URL and try again, you should see a successful greeting.
The intercept method gets called before the routing, and can prevent the requests from being executed by throwing an exception, or returning a promise that later rejects. See web.js for how it's set up in this case, and check out Intercepting Requests API docs for more information