Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

AspnetCore 2.0 sample #2878

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions samples/Nancy.Demo.Hosting.AspnetCore/HomeModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Nancy.Demo.Hosting.AspnetCore
{
public class HomeModule : NancyModule
{
public HomeModule()
{
Get("/", args => "ASP.NET Core hosted Nancy");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
<PackageReference Include="Nancy" Version="2.0.0-clinteastwood" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions samples/Nancy.Demo.Hosting.AspnetCore/Program.cs
Original file line number Diff line number Diff line change
@@ -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<Startup>().Build();
}
}
Original file line number Diff line number Diff line change
@@ -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/"
}
}
}
27 changes: 27 additions & 0 deletions samples/Nancy.Demo.Hosting.AspnetCore/Startup.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
5 changes: 5 additions & 0 deletions samples/Nancy.Demo.Hosting.AspnetCore/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "2.0.5"
}
}