我应该用我自己的Web API [英] Should I be using my own Web API

查看:97
本文介绍了我应该用我自己的Web API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要退房的Web API,我不知道如何asp.net MVC和Web API可以或应该携手合作。

I'm checking out Web API and I'm not sure how asp.net mvc and web api can or should work together.

我要实现在客户端骨干,但我不知道我是否应该实现一个ApiController或在服务器端正常控制器?

I want to implement Backbone on the client side, but I'm not sure if I should implement an ApiController or a normal Controller on the server side?

我做事情的方式(获取当前用户/帐户信息)是一个基础ApiController都会有一些相同的功能将基本控制,这将导致有点重复的功能,但不知道是什么将是其他贸易平衡。

The way I'm doing things (Getting current user / account information) is that a base ApiController will have some of the same functionality as a base Controller would, which would lead to a bit of duplicate functionality, but not sure what would be the other trade offs.

如果不是,您只创建要提供并坚持控制器,用于Web应用程序公共服务的ApiController?

Or would you only create an ApiController for a public service that you want to provide and stick to Controllers for the web app?

推荐答案

如果你计划一个API,使用ApiController。如果你正在做的Web UI的东西,使用经典控制器。这就是两者都对的。

If you're planning an API, use the ApiController. If you're doing Web UI stuff, use the classic Controller. That's what both are made for.

这篇关于我应该用我自己的Web API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆