cancel
Showing results for 
Search instead for 
Did you mean: 

Custom module API vs Controllers

Custom module API vs Controllers

Hi everyone,

 

I saw a few tutorials online about how to create an API for a custom module in M2.

I am wondering why I shouldn't just create one or multiple controllers to provide API features.

What would be the cons of using controller(s) to handle external requests?

 

Thanks a lot for your answers.

1 REPLY 1

Re: Custom module API vs Controllers

Hello @jlinker 

 

 

if you are creating api then no need to create controller for this.

Here example how to create new API

 

https://www.mageplaza.com/devdocs/magento-2-create-api/

 

 

Hope it will clear your doubts

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer