Search code examples
javaspring-mvcweb-applicationsmobile-applicationspring-restcontroller

Designing backend for Mobile app?


I have web application where typical flow is

HTML form submission > MVC Controller(spring) > Services(Fetch data)

Ultimately most of the controllers methods returns html data

Now I need to develop mobile app also. Per mine understanding I need to create new Rest Controllers to return the JSON data.

Mobile app will connect to rest controller whereas web app will continue to connect to web controller already in place. Is that correct ?


Solution

  • This will depend on how your controllers are written.

    If your controller actions resemble REST like actions you could use spring mvc content negotiation to return html or json depending on the request.