Issue
To mock the API I have to create an endpoint on Nginx and the response time should match as I receive from the actual API.
I tried to find help online and came to know that, this echo module can help: https://github.com/openresty/echo-nginx-module But this module does not support nginx 1.17.0 or above and my nginx version is above the supported version.
I also came to know that lua script can also be used but I found that lua script and nginx integrations is not for beginner.
Solution
The simplest and most efficient solution that I found for this use case is nginx-extras which comes with already added extra nginx modules and it have echo module as well, which I was looking. You can find more available modules of your need by clicking the link.
Answered By - Ali k. Answer Checked By - David Marino (WPSolving Volunteer)