Browse files

initial commit

  • Loading branch information...
0 parents commit 005a90d969006c1b56cb3cd45b14376407965c09 @aaronpowell committed Mar 15, 2012
17 .gitignore
@@ -0,0 +1,17 @@
+[Oo]bj/
+[Bb]in/
+*.user
+/TestResults
+*.vspscc
+*.vssscc
+deploy
+deploy/*
+*.suo
+*.cache
+*.docstates
+_ReSharper.*
+*.csproj.user
+*[Rr]e[Ss]harper.user
+_ReSharper.*/
+packages/*
+*.nupkg
20 Owin.HelloWorld.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 11
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Owin.HelloWorld", "Owin.HelloWorld\Owin.HelloWorld.csproj", "{7770974A-6799-4B45-82F7-A12A46950DF1}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7770974A-6799-4B45-82F7-A12A46950DF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7770974A-6799-4B45-82F7-A12A46950DF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7770974A-6799-4B45-82F7-A12A46950DF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7770974A-6799-4B45-82F7-A12A46950DF1}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
98 Owin.HelloWorld/Middleware.cs
@@ -0,0 +1,98 @@
+using System;
+using Gate;
+using Owin;
+namespace Owin.HelloWorld
+{
+ public static class Middleware
+ {
+ public static IAppBuilder Get(this IAppBuilder builder, Action<Request, Response> app)
+ {
+ return builder.Use<AppDelegate>(next => (env, result, fault) =>
+ {
+ if ((string)env["owin.RequestMethod"] == "GET")
+ {
+ var req = new Request(env);
+ var res = new Response(result);
+ app(req, res);
+
+ }
+ else
+ {
+ next(env, result, fault);
+ }
+ });
+ }
+
+ public static IAppBuilder Post(this IAppBuilder builder, Action<Request, Response> app)
+ {
+ return builder.Use<AppDelegate>(next => (env, result, fault) =>
+ {
+ if ((string)env["owin.RequestMethod"] == "POST")
+ {
+ var req = new Request(env);
+ var res = new Response(result);
+ app(req, res);
+
+ }
+ else
+ {
+ next(env, result, fault);
+ }
+ });
+ }
+
+ public static IAppBuilder Put(this IAppBuilder builder, Action<Request, Response> app)
+ {
+ return builder.Use<AppDelegate>(next => (env, result, fault) =>
+ {
+ if ((string)env["owin.RequestMethod"] == "PUT")
+ {
+ var req = new Request(env);
+ var res = new Response(result);
+ app(req, res);
+
+ }
+ else
+ {
+ next(env, result, fault);
+ }
+ });
+ }
+
+ public static IAppBuilder Delete(this IAppBuilder builder, Action<Request, Response> app)
+ {
+ return builder.Use<AppDelegate>(next => (env, result, fault) =>
+ {
+ if ((string)env["owin.RequestMethod"] == "DELETE")
+ {
+ var req = new Request(env);
+ var res = new Response(result);
+ app(req, res);
+
+ }
+ else
+ {
+ next(env, result, fault);
+ }
+ });
+ }
+
+ public static IAppBuilder Patch(this IAppBuilder builder, Action<Request, Response> app)
+ {
+ return builder.Use<AppDelegate>(next => (env, result, fault) =>
+ {
+ if ((string)env["owin.RequestMethod"] == "PATCH")
+ {
+ var req = new Request(env);
+ var res = new Response(result);
+ app(req, res);
+
+ }
+ else
+ {
+ next(env, result, fault);
+ }
+ });
+ }
+ }
+}
107 Owin.HelloWorld/Owin.HelloWorld.csproj
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{7770974A-6799-4B45-82F7-A12A46950DF1}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Owin.HelloWorld</RootNamespace>
+ <AssemblyName>Owin.HelloWorld</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <Prefer32Bit>false</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <Prefer32Bit>false</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup>
+ <StartupObject>Owin.HelloWorld.Program</StartupObject>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Firefly">
+ <HintPath>..\packages\Firefly.0.4\lib\net40\Firefly.dll</HintPath>
+ </Reference>
+ <Reference Include="Gate">
+ <HintPath>..\packages\Gate.0.3.4\lib\net40\Gate.dll</HintPath>
+ </Reference>
+ <Reference Include="Gate.Builder">
+ <HintPath>..\packages\Gate.Builder.0.3.4\lib\net40\Gate.Builder.dll</HintPath>
+ </Reference>
+ <Reference Include="Owin">
+ <HintPath>..\packages\Owin.0.7\lib\net40\Owin.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Middleware.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Startup.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="packages.config">
+ <SubType>Designer</SubType>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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>
21 Owin.HelloWorld/Program.cs
@@ -0,0 +1,21 @@
+using System;
+using Firefly.Http;
+using Gate.Builder;
+using Owin;
+
+namespace Owin.HelloWorld
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ var app = new AppBuilder().Build(Startup.Configuration);
+
+ var server = new ServerFactory().Create(app, 1337);
+
+ Console.WriteLine("Running on http://localhost:1337");
+
+ Console.ReadLine();
+ }
+ }
+}
36 Owin.HelloWorld/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("HelloWorld")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HelloWorld")]
+[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("77db671d-b0c5-4411-be06-fc52e774aa72")]
+
+// 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")]
21 Owin.HelloWorld/Startup.cs
@@ -0,0 +1,21 @@
+using Owin;
+using Gate;
+
+namespace Owin.HelloWorld
+{
+ public class Startup
+ {
+ public static void Configuration(IAppBuilder builder)
+ {
+ builder
+ .RunDirect((req, res) =>
+ {
+ res.ContentType = "text/plain";
+ res.Write("Hello World!\r\n")
+ .End();
+ })
+ ;
+ }
+ }
+
+}
3 Owin.HelloWorld/app.config
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
7 Owin.HelloWorld/packages.config
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Firefly" version="0.4" />
+ <package id="Gate" version="0.3.4" />
+ <package id="Gate.Builder" version="0.3.4" />
+ <package id="Owin" version="0.7" />
+</packages>
1 readme.md
@@ -0,0 +1 @@
+A very simple OWIN hello world app.

0 comments on commit 005a90d

Please sign in to comment.