2017-11-27 21:57:26 +01:00
|
|
|
|
using System.Diagnostics;
|
2017-10-12 16:34:10 +02:00
|
|
|
|
using Nancy;
|
2017-10-04 01:35:25 +02:00
|
|
|
|
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
|
2017-11-27 21:57:26 +01:00
|
|
|
|
pipelines.AfterRequest.AddItemToEndOfPipeline(ctx =>
|
2017-10-04 01:35:25 +02:00
|
|
|
|
{
|
|
|
|
|
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")
|
2017-11-27 21:57:26 +01:00
|
|
|
|
.WithHeader("Last-Modified", Process.GetCurrentProcess().StartTime.ToString());
|
2017-10-04 01:35:25 +02:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|