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 Answers 2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

so in my case my the view is the JSON displayed when i type localhost:XXXX/myroute/{myparam} for example?
I would say yes. It is matter of definition of Model in MVC. In the definition of MVC I come across document returned from backend counts as model. It does not have to be HTLM web page.
so my front end is getting data from the view based on the provided routing url, thanks a lot, marked as the answer
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.

5 Comments

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
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.
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 .
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.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.