forked from anjoy8/Blog.Core
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathApbController.cs
More file actions
36 lines (29 loc) · 1.04 KB
/
ApbController.cs
File metadata and controls
36 lines (29 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Blog.Core.SwaggerHelper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static Blog.Core.SwaggerHelper.CustomApiVersion;
namespace Blog.Core.Controllers.v2
{
[CustomRoute(ApiVersions.V2)]
//[Route("api/[controller]")]
[ApiController]
[Authorize(Permissions.Name)]
public class ApbController : ControllerBase
{
/************************************************/
// 如果需要使用Http协议带名称的,比如这种 [HttpGet("apbs")]
// 目前只能把[CustomRoute(ApiVersions.v2)] 提到 controller 的上边,做controller的特性
// 并且去掉//[Route("api/[controller]")]路由特性,否则会有两个接口
/************************************************/
[HttpGet("apbs")]
public IEnumerable<string> Get()
{
return new string[] { "第二版的 apbs" };
}
}
}