diff --git a/samples/Nancy.Demo.Hosting.AspnetCore/HomeModule.cs b/samples/Nancy.Demo.Hosting.AspnetCore/HomeModule.cs new file mode 100644 index 0000000000..1074534447 --- /dev/null +++ b/samples/Nancy.Demo.Hosting.AspnetCore/HomeModule.cs @@ -0,0 +1,10 @@ +namespace Nancy.Demo.Hosting.AspnetCore +{ + public class HomeModule : NancyModule + { + public HomeModule() + { + Get("/", args => "ASP.NET Core hosted Nancy"); + } + } +} \ No newline at end of file diff --git a/samples/Nancy.Demo.Hosting.AspnetCore/Nancy.Demo.Hosting.AspnetCore.csproj b/samples/Nancy.Demo.Hosting.AspnetCore/Nancy.Demo.Hosting.AspnetCore.csproj new file mode 100644 index 0000000000..4bb0c413e2 --- /dev/null +++ b/samples/Nancy.Demo.Hosting.AspnetCore/Nancy.Demo.Hosting.AspnetCore.csproj @@ -0,0 +1,16 @@ + + + + netcoreapp2.0 + + + + + + + + + + + + diff --git a/samples/Nancy.Demo.Hosting.AspnetCore/Program.cs b/samples/Nancy.Demo.Hosting.AspnetCore/Program.cs new file mode 100644 index 0000000000..c40180f60c --- /dev/null +++ b/samples/Nancy.Demo.Hosting.AspnetCore/Program.cs @@ -0,0 +1,15 @@ +namespace Nancy.Demo.Hosting.AspnetCore +{ + using Microsoft.AspNetCore; + using Microsoft.AspNetCore.Hosting; + + public class Program + { + public static void Main(string[] args) + { + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args).UseStartup().Build(); + } +} diff --git a/samples/Nancy.Demo.Hosting.AspnetCore/Properties/launchSettings.json b/samples/Nancy.Demo.Hosting.AspnetCore/Properties/launchSettings.json new file mode 100644 index 0000000000..f9d95f849c --- /dev/null +++ b/samples/Nancy.Demo.Hosting.AspnetCore/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:63159/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Nancy.Demo.Hosting.Aspnet": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:63160/" + } + } +} diff --git a/samples/Nancy.Demo.Hosting.AspnetCore/Startup.cs b/samples/Nancy.Demo.Hosting.AspnetCore/Startup.cs new file mode 100644 index 0000000000..1fefcae06a --- /dev/null +++ b/samples/Nancy.Demo.Hosting.AspnetCore/Startup.cs @@ -0,0 +1,27 @@ +namespace Nancy.Demo.Hosting.AspnetCore +{ + using Microsoft.AspNetCore.Builder; + using Microsoft.AspNetCore.Hosting; + using Microsoft.Extensions.DependencyInjection; + using Nancy.Owin; + + public class Startup + { + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseOwin().UseNancy(); + } + } +} diff --git a/samples/Nancy.Demo.Hosting.AspnetCore/global.json b/samples/Nancy.Demo.Hosting.AspnetCore/global.json new file mode 100644 index 0000000000..70b09f851e --- /dev/null +++ b/samples/Nancy.Demo.Hosting.AspnetCore/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "2.0.5" + } +}