geekbot/Geekbot.net/WebApi/WebConfig.cs

24 lines
781 B
C#
Raw Normal View History

2017-10-12 16:34:10 +02:00
using System;
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", DateTime.Now.ToString());
});
}
}
}