allow CORS

This commit is contained in:
hak8or 2018-02-28 23:45:49 -05:00
parent 152a000927
commit 5c74e2016a
4 changed files with 14 additions and 0 deletions

View File

@ -53,5 +53,14 @@ namespace YTManager.Controllers {
public IActionResult Get_Update_Status() {
return Ok(get_massupdatedaemon() == null ? "false" : "true");
}
// Testing
[HttpGet("Test")]
public async System.Threading.Tasks.Task<IActionResult> Test() {
// await Tasks.FetchVideos.MassUpdate(Startup.DBStr);
// var vids = Tasks.FetchVideos.Get_YTVideos("UCsXVk37bltHxD1rDPwtNM8Q", 1).Result;
// return Ok(vids);
return Ok();
}
}
}

View File

@ -1,12 +1,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace YTManager.Controllers {
[Produces("application/json")]
[Route("api/Channels")]
[EnableCors("AllowAllOrigins")]
public class ChannelsController : Controller {
// Custom return type for API accesses. Done this way to ensure we
// always return the expected data regardless of the underlying model.

View File

@ -1,12 +1,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace YTManager.Controllers {
[Produces("application/json")]
[Route("api/Videos")]
[EnableCors("AllowAllOrigins")]
public class VideosController : Controller {
// Custom return type for API accesses. Done this way to ensure we
// always return the expected data regardless of the underlying model.

View File

@ -29,6 +29,7 @@ namespace YTManager {
services.AddMvc();
services.AddDbContext<MediaDB>(x => x.UseNpgsql(DBStr));
services.AddHangfire(x => x.UsePostgreSqlStorage(DBStr));
services.AddCors(op => op.AddPolicy("AllowAllOrigins", builder => builder.AllowAnyOrigin()));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.