Light12306/ChatRoomServer.Www/Controllers/RoomController.cs

29 lines
823 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace ChatRoomServer.Www.Controllers
{
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web.Http.Cors;
using System.Web.Mvc.Filters;
using FSLib.Network.Http;
[EnableCors("http://12306.liebao.cn,http://test.fishlee.net", "*", "*", "")]
public class RoomController : Controller
{
[AllowAnonymous]
[HttpGet, OutputCache(Duration = 600, VaryByHeader = "Origin")]
public async Task<ContentResult> List()
{
var client = new HttpClient();
var ctx = client.Create<string>(HttpMethod.Get, $"http://{Request.Url.Host}:{Request.Url.Port}/api/room/list");
await ctx.SendAsync().ConfigureAwait(false);
return Content(ctx.Result, "application/json");
}
}
}