1

I am creating an application which has a front end developped using Angular, and a backend developped using SpringBoot.

The problem is that the backend has controllers with request mappings and models (services and repositories) and no views , so does it really implement the MVC pattern?

enter image description here

I have read in this article " Spring MVC or Spring Boot" that spring MVC which itslef implements the MVC pattern is a part of spring boot, so basically spring boot is MVC, which is true when you have views and HTML pages in your project, but in my case i can't talk about views since i am sending and recieving JSON data from a restful API.

2 Answers2

1

According to https://www.wikiwand.com/en/Model%E2%80%93view%E2%80%93controller

view means presentation of the model in a particular format.

I think it is good definition. Particular format in case of backend for REST API happen to be JSON or XML.

From the same page

Some web MVC frameworks take a thin client approach that places almost the entire model, view and controller logic on the server. In this approach, the client sends either hyperlink requests or form submissions to the controller and then receives a complete and updated web page (or other document) from the view; the model exists entirely on the server.

Bartosz Bilicki
  • 12,599
  • 13
  • 71
  • 113
0

In your case the View would be the front-end. The View is the presentation of the data in a human understandable way.

So I believe the View in your case would be the front-end app.

WilsonPena
  • 1,451
  • 2
  • 18
  • 37
  • how can an MVC pattern be shared between two end's ? i thought that every end of the project had it's own logical architecture for example MVVM for frontend and MVC for backend, correct me if am wrong – Yassine Ben Hamida Apr 24 '18 at 13:15
  • Its a design pattern. But I guess you could say the view is the JSON also. But I think, the most correct understanding of View would be the whole presentation part of your project. The HTML, the json, the javascript, etc. The user interface in general. – WilsonPena Apr 24 '18 at 13:19
  • if i had two controllers one in the front end and another one in the backend would it be still valid? you can't apply a general MVC pattern for the two sides of the project, each side has it's own architecture own params and own functionnalities, take my example in the first picture, am using Angular which is employing the CBA (component based architecture or MV*) for the front end and SpringBoot which is more likely employing MVC . – Yassine Ben Hamida Apr 24 '18 at 13:29
  • Yes, both of them apply MVC. MVC is just a pattern of project. Angular has controllers, models and the view (the HTML). The backend has controllers, models (entities) and the view, that in the case of MVC stands for the part of the app that interacts with the user, and presents the data in a human understandable way. Which would be the frontend. – WilsonPena Apr 24 '18 at 13:33
  • maybe you could say that both of them employ the MVC pattern, but you can't distribute the same pattern on each end, you can't basically say that your model and controller are at the backend and the view is your frontend, the correct way to say it is to state that both of them have models, controllers and views with the backend view communicating with the front end using JSON data. – Yassine Ben Hamida Apr 24 '18 at 13:43