geekbot/Geekbot.net/WebApi/WebConfig.cs

23 lines
814 B
C#
Raw Normal View History

using System.Diagnostics;
2017-10-12 16:34:10 +02:00
using Nancy;
using Nancy.Bootstrapper;
using Nancy.TinyIoc;
namespace Geekbot.net.WebApi
{
public class WebConfig : DefaultNancyBootstrapper
{
protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context)
{
//CORS Enable
pipelines.AfterRequest.AddItemToEndOfPipeline(ctx =>
{
ctx.Response.WithHeader("Access-Control-Allow-Origin", "*")
2017-10-12 16:34:10 +02:00
.WithHeader("Access-Control-Allow-Methods", "GET")
.WithHeader("Access-Control-Allow-Headers", "Accept, Origin, Content-type")
.WithHeader("Last-Modified", Process.GetCurrentProcess().StartTime.ToString());
});
}
}
}