Can kong be used as a wrapper around api service

Can we use kong as a wrapper around api service.

what are the pros and cons ?

can we leverage openresty side of kong to develop REST applications in lua ?

I have kong infront of tomcat which uses spring mvc?
can i remove tomcat and rewrite the whole functionality in kong by leveraging openresty?

Yes. That is one of Kong’s main usecases.

The pros and cons vary a lot on your infrastructure. For the case of wrapping a single API, the most obvious benefit is that you will get a lot of built-in functionality (like healthchecks) and extensions (we call those plugins) in a single, easy to use, open source package. The most obvious downside is that you will have another component to take care of and update in your infrastructure.

Notice how I didn’t list overhead as the main downside. In the case of a single API wrapper (we call this an API gateway), if Kong is properly configured so that there is no network latency, the overhead is usually background noise compared to usual end-to-end latency.

Custom plugins can be developed, but these just “modify how the wrapper works”. Doing a REST application “from scratch” (so Kong itself takes the requests and generates responses instead of acting as an intermediary between a consumer and a service) is possible, but at the moment is not the main focus.

That depends on what your current app is doing. If you are just wrapping an existing API and adding basic functionality to it, then the answer is yes. If you have developed a full-fledged application and are trying to migrate it to Kong, the answer is yes, too. But you might not be using the best tool for the job in that case.