How to create my own REST APIs using OpenMRS module?

Application Name: OpenMRS with a module Version Number: 2.1.1

Question: I created a module for OpenMRS version 2.1.1. It is working fine when it comes to simple MVC but I wanted to create a Rest Controller. But it shows 404 error.

Openmrs rest controllers were made by default to extend MainResourceController, or RestControllers depending on your needs, you first share your logs using , hope u have been following

This has been solved by using the correct request mappings and using @Controller instead of @RestController and @ResponseBody because I don’t know why @RestController somehow didn’t work for me.