Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: akurdyukov/NancyKayakDemo
base: d7459d08d2
...
head fork: akurdyukov/NancyKayakDemo
compare: 1daed75e3c
  • 2 commits
  • 14 files changed
  • 0 commit comments
  • 1 contributor
View
6 .gitignore
@@ -3,4 +3,8 @@ bin
obj
# mstest test results
-TestResults
+TestResults
+/_ReSharper.NancyKayakDemo
+/packages
+/NancyKayakDemo.1.2.dotCover
+*.suo
View
6 .nuget/NuGet.Config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <solution>
+ <add key="disableSourceControlIntegration" value="true" />
+ </solution>
+</configuration>
View
139 .nuget/NuGet.targets
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
+
+ <!-- Enable the restore command to run before builds -->
+ <RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
+
+ <!-- Property that enables building a package from a project -->
+ <BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
+
+ <!-- Download NuGet.exe if it does not already exist -->
+ <DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
+ </PropertyGroup>
+
+ <ItemGroup Condition=" '$(PackageSources)' == '' ">
+ <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
+ <!--
+ <PackageSource Include="https://nuget.org/api/v2/" />
+ <PackageSource Include="https://my-nuget-source/nuget/" />
+ -->
+ </ItemGroup>
+
+ <PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
+ <!-- Windows specific commands -->
+ <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
+ <PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
+ <PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
+ <!-- We need to launch nuget.exe with the mono command if we're not on windows -->
+ <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
+ <PackagesConfig>packages.config</PackagesConfig>
+ <PackagesDir>$(SolutionDir)packages</PackagesDir>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <!-- NuGet command -->
+ <NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
+ <PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
+
+ <NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
+ <NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
+
+ <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
+
+ <!-- Commands -->
+ <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" -o "$(PackagesDir)"</RestoreCommand>
+ <BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(RestorePackages) == 'true'">
+ RestorePackages;
+ $(BuildDependsOn);
+ </BuildDependsOn>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(BuildPackage) == 'true'">
+ $(BuildDependsOn);
+ BuildPackage;
+ </BuildDependsOn>
+ </PropertyGroup>
+
+ <Target Name="CheckPrerequisites">
+ <!-- Raise an error if we're unable to locate nuget.exe -->
+ <Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
+ <SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
+ <DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
+ </Target>
+
+ <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(RestoreCommand)"
+ Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
+
+ <Exec Command="$(RestoreCommand)"
+ LogStandardErrorAsError="true"
+ Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
+ </Target>
+
+ <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(BuildCommand)"
+ Condition=" '$(OS)' != 'Windows_NT' " />
+
+ <Exec Command="$(BuildCommand)"
+ LogStandardErrorAsError="true"
+ Condition=" '$(OS)' == 'Windows_NT' " />
+ </Target>
+
+ <UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
+ <ParameterGroup>
+ <OutputFilename ParameterType="System.String" Required="true" />
+ </ParameterGroup>
+ <Task>
+ <Reference Include="System.Core" />
+ <Using Namespace="System" />
+ <Using Namespace="System.IO" />
+ <Using Namespace="System.Net" />
+ <Using Namespace="Microsoft.Build.Framework" />
+ <Using Namespace="Microsoft.Build.Utilities" />
+ <Code Type="Fragment" Language="cs">
+ <![CDATA[
+ try {
+ OutputFilename = Path.GetFullPath(OutputFilename);
+
+ Log.LogMessage("Downloading latest version of NuGet.exe...");
+ WebClient webClient = new WebClient();
+ webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
+
+ return true;
+ }
+ catch (Exception ex) {
+ Log.LogErrorFromException(ex);
+ return false;
+ }
+ ]]>
+ </Code>
+ </Task>
+ </UsingTask>
+
+ <UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
+ <ParameterGroup>
+ <EnvKey ParameterType="System.String" Required="true" />
+ <EnvValue ParameterType="System.String" Required="true" />
+ </ParameterGroup>
+ <Task>
+ <Using Namespace="System" />
+ <Code Type="Fragment" Language="cs">
+ <![CDATA[
+ try {
+ Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
+ }
+ catch {
+ }
+ ]]>
+ </Code>
+ </Task>
+ </UsingTask>
+</Project>
View
BIN  .nuget/nuget.exe
Binary file not shown
View
27 NancyKayakDemo.sln
@@ -0,0 +1,27 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NancyKayakDemo", "NancyKayakDemo\NancyKayakDemo.csproj", "{86505CE3-666E-40B5-A99A-5C315001DB25}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{E6B2414C-D3A9-4E8D-88AD-06BE7B5C4565}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\nuget.exe = .nuget\nuget.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {86505CE3-666E-40B5-A99A-5C315001DB25}.Debug|x86.ActiveCfg = Debug|x86
+ {86505CE3-666E-40B5-A99A-5C315001DB25}.Debug|x86.Build.0 = Debug|x86
+ {86505CE3-666E-40B5-A99A-5C315001DB25}.Release|x86.ActiveCfg = Release|x86
+ {86505CE3-666E-40B5-A99A-5C315001DB25}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
8 NancyKayakDemo/LocalBootstrapper.cs
@@ -0,0 +1,8 @@
+using Nancy.Bootstrappers.Windsor;
+
+namespace NancyKayakDemo
+{
+ public class LocalBootstrapper : WindsorNancyBootstrapper
+ {
+ }
+}
View
82 NancyKayakDemo/NancyKayakDemo.csproj
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{86505CE3-666E-40B5-A99A-5C315001DB25}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>NancyKayakDemo</RootNamespace>
+ <AssemblyName>NancyKayakDemo</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Castle.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+ <HintPath>..\packages\Castle.Core.3.0.0.4001\lib\net40-client\Castle.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="Castle.Windsor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+ <HintPath>..\packages\Castle.Windsor.3.0.0.4001\lib\net40\Castle.Windsor.dll</HintPath>
+ </Reference>
+ <Reference Include="Kayak">
+ <HintPath>..\packages\Kayak.0.7.2\lib\Kayak.dll</HintPath>
+ </Reference>
+ <Reference Include="Nancy">
+ <HintPath>..\packages\Nancy.0.11.0\lib\net40\Nancy.dll</HintPath>
+ </Reference>
+ <Reference Include="Nancy.Bootstrappers.Windsor, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\Nancy.Bootstrappers.Windsor.0.11.0\lib\net40\Nancy.Bootstrappers.Windsor.dll</HintPath>
+ </Reference>
+ <Reference Include="Nancy.Hosting.Owin">
+ <HintPath>..\packages\Nancy.Hosting.Owin.0.11.0\lib\net40\Nancy.Hosting.Owin.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="LocalBootstrapper.cs" />
+ <Compile Include="OwinHttpRequestDelegate.cs" />
+ <Compile Include="OwinServer.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
253 NancyKayakDemo/OwinHttpRequestDelegate.cs
@@ -0,0 +1,253 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Kayak;
+using Kayak.Http;
+
+namespace NancyKayakDemo
+{
+ using ResultAction = Action<
+ string,
+ IDictionary<string, string>,
+ Func< //body
+ Func< //next
+ ArraySegment<byte>, // data
+ Action, // continuation
+ bool>, // continuation was or will be invoked
+ Action<Exception>, //error
+ Action, //complete
+ Action>>; //cancel
+
+ using AppAction = Action< // app
+ IDictionary<string, object>, // env
+ Action< // result
+ string, // status
+ IDictionary<string, string>, // headers
+ Func< // body
+ Func< // next
+ ArraySegment<byte>, // data
+ Action, // continuation
+ bool>, // async
+ Action<Exception>, // error
+ Action, // complete
+ Action>>, // cancel
+ Action<Exception>>; // error
+
+ using BodyAction = Func< //body
+ Func< //next
+ ArraySegment<byte>, // data
+ Action, // continuation
+ bool>, // continuation was or will be invoked
+ Action<Exception>, //error
+ Action, //complete
+ Action>; // cancel
+
+ internal class OwinHttpRequestDelegate : IHttpRequestDelegate
+ {
+ private readonly AppAction owin;
+
+ internal OwinHttpRequestDelegate(AppAction owin)
+ {
+ this.owin = owin;
+ }
+
+ private static IDictionary<string, object> ToOwinEnvironment(HttpRequestHead head)
+ {
+ var env = new Dictionary<string, object>
+ {
+ {"owin.RequestMethod", head.Method ?? ""},
+ {"owin.RequestPath", head.Path},
+ {"owin.RequestPathBase", ""},
+ {"owin.RequestQueryString", head.QueryString ?? ""},
+ {"owin.RequestScheme", "http"},
+ {"owin.RequestHeaders", head.Headers ?? new Dictionary<string, string>()},
+ {"owin.Version", "1.0"}
+ };
+
+ return env;
+ }
+
+ public void OnRequest(
+ HttpRequestHead head,
+ IDataProducer body,
+ IHttpResponseDelegate response)
+ {
+ var env = ToOwinEnvironment(head);
+
+ if (body == null)
+ env["owin.RequestBody"] = null;
+ else
+ {
+ BodyAction bodyFunc = (onData, onError, onEnd) =>
+ {
+ var d = body.Connect(new DataConsumer(onData, onError, onEnd));
+ return () => { if (d != null) d.Dispose(); };
+ };
+
+ env["owin.RequestBody"] = bodyFunc;
+ }
+
+ owin(env, HandleResponse(response), HandleError(response));
+ }
+
+ ResultAction HandleResponse(IHttpResponseDelegate response)
+ {
+ return (status, headers, body) =>
+ {
+ if (headers == null)
+ headers = new Dictionary<string, string>();
+
+ if (body != null &&
+ !headers.Keys.Contains("content-length", StringComparer.OrdinalIgnoreCase) &&
+ !headers.Keys.Contains("transfer-encoding", StringComparer.OrdinalIgnoreCase))
+ {
+ // consume body and calculate Content-Length
+ BufferBody(response)(status, headers, body);
+ }
+ else
+ {
+ response.OnResponse(new HttpResponseHead
+ {
+ Status = status,
+ Headers = headers.ToDictionary(kv => kv.Key, kv => string.Join("\r\n", kv.Value.ToArray()), StringComparer.OrdinalIgnoreCase),
+ }, body == null ? null : new DataProducer(body));
+ }
+ };
+ }
+
+ ResultAction BufferBody(IHttpResponseDelegate response)
+ {
+ return (status, headers, body) =>
+ {
+ var buffer = new LinkedList<ArraySegment<byte>>();
+
+ body((data, continuation) =>
+ {
+ var copy = new byte[data.Count];
+ Buffer.BlockCopy(data.Array, data.Offset, copy, 0, data.Count);
+ buffer.AddLast(new ArraySegment<byte>(copy));
+ return false;
+ },
+ HandleError(response),
+ () =>
+ {
+ var contentLength = buffer.Aggregate(0, (r, i) => r + i.Count);
+
+ IDataProducer responseBody = null;
+
+ if (contentLength > 0)
+ {
+ headers["Content-Length"] = contentLength.ToString();
+
+ responseBody = new DataProducer((onData, onError, onComplete) =>
+ {
+ bool cancelled = false;
+
+ while (!cancelled && buffer.Count > 0)
+ {
+ var next = buffer.First;
+ buffer.RemoveFirst();
+ onData(next.Value, null);
+ }
+
+ onComplete();
+
+ buffer = null;
+
+ return () => cancelled = true;
+ });
+ }
+
+ response.OnResponse(new HttpResponseHead
+ {
+ Status = status,
+ Headers = headers
+ }, responseBody);
+ });
+ };
+ }
+
+ Action<Exception> HandleError(IHttpResponseDelegate response)
+ {
+ return error =>
+ {
+ Console.Error.WriteLine("Error from Owin application.");
+ Console.Error.WriteStackTrace(error);
+
+ response.OnResponse(new HttpResponseHead
+ {
+ Status = "503 Internal Server Error",
+ Headers = new Dictionary<string, string>
+ {
+ { "Connection", "close" }
+ }
+ }, null);
+ };
+ }
+ }
+
+ internal class DataConsumer : IDataConsumer
+ {
+ readonly Func<ArraySegment<byte>, Action, bool> onData;
+ readonly Action<Exception> onError;
+ readonly Action onEnd;
+
+ public DataConsumer(
+ Func<ArraySegment<byte>, Action, bool> onData,
+ Action<Exception> onError,
+ Action onEnd)
+ {
+ this.onData = onData;
+ this.onError = onError;
+ this.onEnd = onEnd;
+ }
+
+ public bool OnData(ArraySegment<byte> data, Action continuation)
+ {
+ return onData(data, continuation);
+ }
+
+ public void OnEnd()
+ {
+ onEnd();
+ }
+
+ public void OnError(Exception e)
+ {
+ onError(e);
+ }
+ }
+
+ internal class DataProducer : IDataProducer
+ {
+ readonly BodyAction body;
+
+ public DataProducer(BodyAction body)
+ {
+ this.body = body;
+ }
+
+ public IDisposable Connect(IDataConsumer channel)
+ {
+ return new Disposable(body(
+ (data, continuation) => channel.OnData(data, continuation),
+ error => channel.OnError(error),
+ () => channel.OnEnd()));
+ }
+ }
+
+ internal class Disposable : IDisposable
+ {
+ readonly Action dispose;
+
+ public Disposable(Action dispose)
+ {
+ this.dispose = dispose;
+ }
+
+ public void Dispose()
+ {
+ dispose();
+ }
+ }
+}
View
92 NancyKayakDemo/OwinServer.cs
@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Threading.Tasks;
+using Kayak;
+using Kayak.Http;
+
+namespace NancyKayakDemo
+{
+ // Give the owin app Action a shorthand:
+ using AppAction = Action< // app
+ IDictionary<string, object>, // env
+ Action< // result
+ string, // status
+ IDictionary<string, string>, // headers
+ Func< // body
+ Func< // next
+ ArraySegment<byte>, // data
+ Action, // continuation
+ bool>, // async
+ Action<Exception>, // error
+ Action, // complete
+ Action>>, // cancel
+ Action<Exception>>; // error
+
+ public class OwinServer
+ {
+ private readonly IScheduler scheduler;
+ private readonly IServer server;
+
+ public OwinServer(AppAction owin)
+ : this(owin, null, null)
+ {
+ }
+
+ public OwinServer(
+ AppAction owin,
+ Action<IScheduler, Exception> onException,
+ Action<IScheduler> onStop)
+ {
+ scheduler = KayakScheduler.Factory.Create(new DefaultSchedulerDelegate(onException, onStop));
+
+ // The OwinServer uses an internal implementation of IHttpRequestDelegate:
+ server = KayakServer.Factory.CreateHttp(
+ new OwinHttpRequestDelegate(owin),
+ scheduler);
+ }
+
+ public void Start(IPAddress address, int port)
+ {
+ var endPoint = new IPEndPoint(address, port);
+
+ Task task = new Task(() =>
+ {
+ using (server.Listen(endPoint))
+ scheduler.Start();
+ });
+ task.Start();
+ }
+
+ public void Stop()
+ {
+ scheduler.Stop();
+ }
+
+ class DefaultSchedulerDelegate : ISchedulerDelegate
+ {
+ private readonly Action<IScheduler, Exception> onException;
+ private readonly Action<IScheduler> onStop;
+
+ public DefaultSchedulerDelegate(
+ Action<IScheduler, Exception> onException,
+ Action<IScheduler> onStop)
+ {
+ this.onException = onException;
+ this.onStop = onStop;
+ }
+
+ public void OnException(IScheduler scheduler, Exception e)
+ {
+ if (onException != null)
+ onException(scheduler, e);
+ }
+
+ public void OnStop(IScheduler scheduler)
+ {
+ if (onStop != null)
+ onStop(scheduler);
+ }
+ }
+ }
+}
View
33 NancyKayakDemo/Program.cs
@@ -0,0 +1,33 @@
+using System;
+using Nancy;
+
+namespace NancyKayakDemo
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ // Create a new Nancy instance
+ var nancy = new Nancy.Hosting.Owin.NancyOwinHost();
+
+ // Create a new OwinServer (based on Kayak)
+ var server = new OwinServer(nancy.ProcessRequest);
+
+ // Start the OwinServer
+ server.Start(System.Net.IPAddress.Any, 8080);
+
+ Console.WriteLine("Nancy+Owin+Kayak is listening at 8080");
+ Console.ReadLine();
+
+ server.Stop();
+ }
+ }
+
+ public class MainModule : NancyModule
+ {
+ public MainModule()
+ {
+ Get["/"] = _ => "Hello, World!";
+ }
+ }
+}
View
36 NancyKayakDemo/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("NancyKayakDemo")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NancyKayakDemo")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7a634f11-ada3-4260-9e78-81cfa1a73884")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
3  NancyKayakDemo/app.config
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
View
9 NancyKayakDemo/packages.config
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Castle.Core" version="3.0.0.4001" targetFramework="net40" />
+ <package id="Castle.Windsor" version="3.0.0.4001" targetFramework="net40" />
+ <package id="Kayak" version="0.7.2" targetFramework="net40-Client" />
+ <package id="Nancy" version="0.11.0" targetFramework="net40-Client" />
+ <package id="Nancy.Bootstrappers.Windsor" version="0.11.0" targetFramework="net40" />
+ <package id="Nancy.Hosting.Owin" version="0.11.0" targetFramework="net40-Client" />
+</packages>
View
2  README.md
@@ -1,4 +1,4 @@
NancyKayakDemo
==============
-Simple demo for NancyFx + Nancy.Hosting.Owin + Kayak
+Simple demo for NancyFx + Nancy.Hosting.Owin + Kayak. It's based on code found at http://pastebin.com/eVuFEqXd

No commit comments for this range

Something went wrong with that request. Please try again.