简体   繁体   中英

What is the VIEW in a backend REST-API?

sorry for that stupid question.

I want to create a simple REST-API (or maybe later in combination with GraphQL).
PS: I'm using C#.NET Core / .NET-5.0 and PostGreSQL. Working with Rider with an "empty solution".

API-Controller Models Services Repositories Database
Request InputModel DataValidation, DataManipulation, IPO DB-Entities SQL-Code
Response OutputModel DataManipulation, DataValidation, IPO DB-Entities SQL-Code

So I have this structure (directories):

  • Controllers {... }
  • Models
    • Commons {... }
    • Inputs {... }
    • Entities {... }
    • Outputs {... }
  • Services {... }
  • PgsqlRepository {... }

In my mind, the VIEW of a REST API is the combination of the "end point" and the "output model".
Both are provided by the corresponding API controller.

So where exactly is the VIEW in the MVC for a REST API?
Or is a backend interface (with REST API) not a classic MVC at all?

And yes, the MVVM in the frontend naturally offers a VIEW and a ViewModel.
But my question is only about the backend.

there are different types of controller - having different functionalities -

An API controller can not return view instead of they return serialized data whereas an MVC controller can return a view.

if this is what you're seeking.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM