catURL
Number of APIs: 2
We'll start with a simple Node app that functions like a URL shortener. In our case, we'll transform one URL into a different one using cat verbs, cat adjectives, and cat emojis π±β-βand when you input your custom URL into a browser, you'll be redirected back to the original website.
](/assets/blogs/https://i.imgur.com/yypLUxZ.jpg)
Get started
This collection and environment was originally used as an example in Deploying a scalable web application with Docker and Kubernetes from the Qodex Engineering blog.
If you want to follow along, go ahead and fork this example and follow the README steps to spin up a local version of these APIs.
The beauty of using containers is that even if I'm developing this example on a machine with my Operating System and a different version of Node, you can rely on my container image to prescribe the exact specifications you'll need to run the same application seamlessly on your machine, or in the cloud, or wherever you choose to deploy.
Test the redirect
Since we're working with redirects, let's set up Qodex so we can properly test these requests. By default, Qodex will follow a redirect -- unless we tell it not to. If we update our general Qodex settings to disallow redirects, we can inspect our server's response headers before the redirection.
- To run the
redirect test
request, make sure you haveAutomatically follow redirects
toggled OFF under the general Qodex app settings. - To run the collection in the Qodex app via collection runner, make sure you have the same
Automatically follow redirects
toggled OFF. - To run the collection using Qodex's command line runner Newman, make sure you include the flag
--ignore-redirects
with your command. - To run the collection from the Qodex cloud using a monitor, make sure you check the box that says
Don't follow redirects
.
-
urlize POST {{url}}/encode
-
redirect allow GET {{url}}/{{path}}