简体   繁体   English

后端 REST-API 中的 VIEW 是什么?

[英]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).我想创建一个简单的 REST-API(或者稍后可能与 GraphQL 结合使用)。
PS: I'm using C#.NET Core / .NET-5.0 and PostGreSQL. Working with Rider with an "empty solution". PS:我正在使用 C#.NET Core / .NET-5.0 和 PostGreSQL。使用“空解决方案”与 Rider 合作。

API-Controller API控制器 Models楷模 Services服务 Repositories资料库 Database数据库
Request要求 InputModel输入模型 DataValidation, DataManipulation, IPO数据验证、数据操作、IPO DB-Entities数据库实体 SQL-Code SQL代码
Response回复 OutputModel输出模型 DataManipulation, DataValidation, IPO数据操作、数据验证、IPO DB-Entities数据库实体 SQL-Code SQL代码

So I have this structure (directories):所以我有这个结构(目录):

  • Controllers {... }控制器 {...}
  • Models楷模
    • Commons {... }下议院{...}
    • Inputs {... }输入 {...}
    • Entities {... }实体{...}
    • Outputs {... }输出 {...}
  • Services {... }服务 {... }
  • PgsqlRepository {... } PgsqlRepository {...}

In my mind, the VIEW of a REST API is the combination of the "end point" and the "output model".在我看来,一个REST API的VIEW是“端点”和“输出模型”的组合。
Both are provided by the corresponding API controller.两者均由对应的API controller提供。

So where exactly is the VIEW in the MVC for a REST API?那么 REST API 的 MVC 中的 VIEW 到底在哪里?
Or is a backend interface (with REST API) not a classic MVC at all?或者后端接口(带有 REST API)根本不是经典的 MVC?

And yes, the MVVM in the frontend naturally offers a VIEW and a ViewModel.是的,前端的 MVVM 自然会提供一个 VIEW 和一个 ViewModel。
But my question is only about the backend.但我的问题只是关于后端。

there are different types of controller - having different functionalities -有不同类型的 controller - 具有不同的功能 -

An API controller can not return view instead of they return serialized data whereas an MVC controller can return a view. API controller 不能返回视图,而是返回序列化数据,而 MVC controller 可以返回视图。

if this is what you're seeking.如果这是你正在寻找的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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