mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 18:22:49 +08:00
Merge pull request #5 from TomPallister/makingworkinvs
after hours of pissing around on the mac...gave up..so got this confi…
This commit is contained in:
commit
21fdca4937
49
.vscode/launch.json
vendored
49
.vscode/launch.json
vendored
@ -1,49 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": ".NET Core Launch (console)",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "build",
|
|
||||||
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
|
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"stopAtEntry": false,
|
|
||||||
"externalConsole": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": ".NET Core Launch (web)",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "build",
|
|
||||||
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
|
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"stopAtEntry": false,
|
|
||||||
"launchBrowser": {
|
|
||||||
"enabled": true,
|
|
||||||
"args": "${auto-detect-url}",
|
|
||||||
"windows": {
|
|
||||||
"command": "cmd.exe",
|
|
||||||
"args": "/C start ${auto-detect-url}"
|
|
||||||
},
|
|
||||||
"osx": {
|
|
||||||
"command": "open"
|
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"command": "xdg-open"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": ".NET Core Attach",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "attach",
|
|
||||||
"processId": 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
50
Ocelot.sln
Normal file
50
Ocelot.sln
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 14
|
||||||
|
VisualStudioVersion = 14.0.25420.1
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5CFB79B7-C9DC-45A4-9A75-625D92471702}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3FA7C349-DBE8-4904-A2CE-015B8869CE6C}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
global.json = global.json
|
||||||
|
LICENSE.md = LICENSE.md
|
||||||
|
README.md = README.md
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Ocelot", "src\Ocelot\Ocelot.xproj", "{AEC8FB40-B370-48A6-9B38-78E560041F01}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Ocelot.Library", "src\Ocelot.Library\Ocelot.Library.xproj", "{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{5B401523-36DA-4491-B73A-7590A26E420B}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Ocelot.UnitTests", "test\Ocelot.UnitTests\Ocelot.UnitTests.xproj", "{54E84F1A-E525-4443-96EC-039CBD50C263}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{AEC8FB40-B370-48A6-9B38-78E560041F01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{AEC8FB40-B370-48A6-9B38-78E560041F01}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{AEC8FB40-B370-48A6-9B38-78E560041F01}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{AEC8FB40-B370-48A6-9B38-78E560041F01}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{AEC8FB40-B370-48A6-9B38-78E560041F01} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
|
||||||
|
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
|
||||||
|
{54E84F1A-E525-4443-96EC-039CBD50C263} = {5B401523-36DA-4491-B73A-7590A26E420B}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
6
global.json
Normal file
6
global.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"projects": [ "src", "test" ],
|
||||||
|
"sdk": {
|
||||||
|
"version": "1.0.0-preview2-003121"
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +0,0 @@
|
|||||||
FROM microsoft/aspnet:1.0.0-rc1-update1
|
|
||||||
|
|
||||||
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
|
|
||||||
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
WORKDIR /app
|
|
||||||
RUN ["dnu", "restore"]
|
|
||||||
|
|
||||||
EXPOSE 5000/tcp
|
|
||||||
ENTRYPOINT ["dnx", "-p", "project.json", "Microsoft.AspNet.Server.Kestrel", "--server.urls", "http://0.0.0.0:5000"]
|
|
@ -1,65 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"version": "1.0.0-rc2-3002702",
|
|
||||||
"type": "platform"
|
|
||||||
},
|
|
||||||
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
|
|
||||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
|
|
||||||
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
|
|
||||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
|
|
||||||
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
|
|
||||||
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
|
|
||||||
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
|
|
||||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
|
|
||||||
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
|
|
||||||
"xunit": "2.1.0",
|
|
||||||
"dotnet-test-xunit": "1.0.0-rc2-final",
|
|
||||||
"Shouldly": "2.8.0"
|
|
||||||
},
|
|
||||||
|
|
||||||
"testRunner":"xunit",
|
|
||||||
|
|
||||||
"tools": {
|
|
||||||
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
|
|
||||||
"version": "1.0.0-preview1-final",
|
|
||||||
"imports": "portable-net45+win8+dnxcore50"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"frameworks": {
|
|
||||||
"netcoreapp1.0": {
|
|
||||||
"imports": [
|
|
||||||
"dotnet5.6",
|
|
||||||
"dnxcore50",
|
|
||||||
"portable-net45+win8"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"buildOptions": {
|
|
||||||
"emitEntryPoint": true,
|
|
||||||
"preserveCompilationContext": true
|
|
||||||
},
|
|
||||||
|
|
||||||
"runtimeOptions": {
|
|
||||||
"gcServer": true
|
|
||||||
},
|
|
||||||
|
|
||||||
"publishOptions": {
|
|
||||||
"include": [
|
|
||||||
"wwwroot",
|
|
||||||
"Views",
|
|
||||||
"appsettings.json",
|
|
||||||
"web.config"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
"scripts": {
|
|
||||||
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
|
|
||||||
},
|
|
||||||
|
|
||||||
"tooling": {
|
|
||||||
"defaultNamespace": "Ocelot.ApiGateway"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
namespace Ocelot.ApiGateway.Infrastructure.Responses
|
namespace Ocelot.Library.Infrastructure.Responses
|
||||||
{
|
{
|
||||||
public abstract class Error
|
public abstract class Error
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.ApiGateway.Infrastructure.Responses
|
using System.Collections.Generic;
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Infrastructure.Responses
|
||||||
|
{
|
||||||
public class ErrorResponse : Response
|
public class ErrorResponse : Response
|
||||||
{
|
{
|
||||||
public ErrorResponse(List<Error> errors) : base(errors)
|
public ErrorResponse(List<Error> errors) : base(errors)
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.ApiGateway.Infrastructure.Responses
|
using System.Collections.Generic;
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Infrastructure.Responses
|
||||||
|
{
|
||||||
public class ErrorResponse<T> : Response<T>
|
public class ErrorResponse<T> : Response<T>
|
||||||
{
|
{
|
||||||
public ErrorResponse(List<Error> errors) : base(errors)
|
public ErrorResponse(List<Error> errors) : base(errors)
|
@ -1,4 +1,4 @@
|
|||||||
namespace Ocelot.ApiGateway.Infrastructure.Responses
|
namespace Ocelot.Library.Infrastructure.Responses
|
||||||
{
|
{
|
||||||
public class OkResponse : Response
|
public class OkResponse : Response
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Ocelot.ApiGateway.Infrastructure.Responses
|
namespace Ocelot.Library.Infrastructure.Responses
|
||||||
{
|
{
|
||||||
public class OkResponse<T> : Response<T>
|
public class OkResponse<T> : Response<T>
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.ApiGateway.Infrastructure.Responses
|
using System.Collections.Generic;
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Infrastructure.Responses
|
||||||
|
{
|
||||||
public abstract class Response
|
public abstract class Response
|
||||||
{
|
{
|
||||||
protected Response()
|
protected Response()
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.ApiGateway.Infrastructure.Responses
|
using System.Collections.Generic;
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Infrastructure.Responses
|
||||||
|
{
|
||||||
public abstract class Response<T> : Response
|
public abstract class Response<T> : Response
|
||||||
{
|
{
|
||||||
protected Response(T data)
|
protected Response(T data)
|
@ -1,6 +1,6 @@
|
|||||||
using Ocelot.ApiGateway.Infrastructure.Responses;
|
using Ocelot.Library.Infrastructure.Responses;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway.Infrastructure.Router
|
namespace Ocelot.Library.Infrastructure.Router
|
||||||
{
|
{
|
||||||
public interface IRouterService
|
public interface IRouterService
|
||||||
{
|
{
|
@ -1,12 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Ocelot.ApiGateway.Infrastructure.Responses;
|
using Ocelot.Library.Infrastructure.Responses;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway.Infrastructure.Router
|
namespace Ocelot.Library.Infrastructure.Router
|
||||||
{
|
{
|
||||||
public class InMemoryRouterService : IRouterService
|
public class InMemoryRouterService : IRouterService
|
||||||
{
|
{
|
||||||
private Dictionary<string, string> _routes;
|
private readonly Dictionary<string, string> _routes;
|
||||||
public InMemoryRouterService()
|
public InMemoryRouterService()
|
||||||
{
|
{
|
||||||
_routes = new Dictionary<string,string>();
|
_routes = new Dictionary<string,string>();
|
@ -1,4 +1,4 @@
|
|||||||
namespace Ocelot.ApiGateway.Infrastructure.Router
|
namespace Ocelot.Library.Infrastructure.Router
|
||||||
{
|
{
|
||||||
public class Route
|
public class Route
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using Ocelot.ApiGateway.Infrastructure.Responses;
|
using Ocelot.Library.Infrastructure.Responses;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway.Infrastructure.Router
|
namespace Ocelot.Library.Infrastructure.Router
|
||||||
{
|
{
|
||||||
public class RouteKeyAlreadyExists : Error
|
public class RouteKeyAlreadyExists : Error
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using Ocelot.ApiGateway.Infrastructure.Responses;
|
using Ocelot.Library.Infrastructure.Responses;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway.Infrastructure.Router
|
namespace Ocelot.Library.Infrastructure.Router
|
||||||
{
|
{
|
||||||
public class RouteKeyDoesNotExist : Error
|
public class RouteKeyDoesNotExist : Error
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway.Middleware
|
namespace Ocelot.Library.Middleware
|
||||||
{
|
{
|
||||||
public static class ProxyExtensions
|
public static class ProxyExtensions
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway.Middleware
|
namespace Ocelot.Library.Middleware
|
||||||
{
|
{
|
||||||
public class ProxyMiddleware
|
public class ProxyMiddleware
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway.Middleware
|
namespace Ocelot.Library.Middleware
|
||||||
{
|
{
|
||||||
public static class RequestLoggerExtensions
|
public static class RequestLoggerExtensions
|
||||||
{
|
{
|
@ -2,7 +2,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway.Middleware
|
namespace Ocelot.Library.Middleware
|
||||||
{
|
{
|
||||||
public class RequestLoggerMiddleware
|
public class RequestLoggerMiddleware
|
||||||
{
|
{
|
21
src/Ocelot.Library/Ocelot.Library.xproj
Normal file
21
src/Ocelot.Library/Ocelot.Library.xproj
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>d6df4206-0dba-41d8-884d-c3e08290fdbb</ProjectGuid>
|
||||||
|
<RootNamespace>Ocelot.Library</RootNamespace>
|
||||||
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||||
|
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
</Project>
|
19
src/Ocelot.Library/Properties/AssemblyInfo.cs
Normal file
19
src/Ocelot.Library/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
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: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Ocelot.Library")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
|
||||||
|
// 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("d6df4206-0dba-41d8-884d-c3e08290fdbb")]
|
30
src/Ocelot.Library/project.json
Normal file
30
src/Ocelot.Library/project.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "platform"
|
||||||
|
},
|
||||||
|
"Microsoft.AspNetCore.Mvc": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.Json": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging.Console": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging.Debug": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Http": "1.0.0"
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"netcoreapp1.0": {
|
||||||
|
"imports": [
|
||||||
|
"dotnet5.6",
|
||||||
|
"portable-net45+win8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
src/Ocelot/Ocelot.xproj
Normal file
19
src/Ocelot/Ocelot.xproj
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>aec8fb40-b370-48a6-9b38-78e560041f01</ProjectGuid>
|
||||||
|
<RootNamespace>Ocelot</RootNamespace>
|
||||||
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||||
|
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
</Project>
|
@ -1,8 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway
|
namespace Ocelot
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
@ -3,20 +3,20 @@
|
|||||||
"windowsAuthentication": false,
|
"windowsAuthentication": false,
|
||||||
"anonymousAuthentication": true,
|
"anonymousAuthentication": true,
|
||||||
"iisExpress": {
|
"iisExpress": {
|
||||||
"applicationUrl": "http://localhost:55368/",
|
"applicationUrl": "http://localhost:1798/",
|
||||||
"sslPort": 0
|
"sslPort": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName" : "IISExpress",
|
"commandName": "IISExpress",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "api/values",
|
"launchUrl": "api/values",
|
||||||
"environmentVariables" : {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Ocelot.ApiGateway": {
|
"Ocelot": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "http://localhost:5000/api/values",
|
"launchUrl": "http://localhost:5000/api/values",
|
@ -1,13 +1,11 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.AspNetCore.Routing;
|
|
||||||
using Ocelot.ApiGateway.Middleware;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway
|
namespace Ocelot
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
@ -26,17 +24,14 @@ namespace Ocelot.ApiGateway
|
|||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddRouting();
|
// Add framework services.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||||
|
|
||||||
app.UseRequestLogger();
|
|
||||||
app.UseProxy();
|
|
||||||
|
|
||||||
loggerFactory.AddDebug();
|
loggerFactory.AddDebug();
|
||||||
|
|
||||||
app.Run(async context =>
|
app.Run(async context =>
|
||||||
@ -46,4 +41,3 @@ namespace Ocelot.ApiGateway
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
src/Ocelot.ApiGateway/appsettings.json → src/Ocelot/appsettings.json
Executable file → Normal file
2
src/Ocelot.ApiGateway/appsettings.json → src/Ocelot/appsettings.json
Executable file → Normal file
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": false,
|
"IncludeScopes": false,
|
||||||
"LogLevel": {
|
"LogLevel": {
|
58
src/Ocelot/project.json
Normal file
58
src/Ocelot/project.json
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "platform"
|
||||||
|
},
|
||||||
|
"Microsoft.AspNetCore.Mvc": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Http": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.Json": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging.Console": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging.Debug": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
|
||||||
|
"Ocelot.Library": "1.0.0-*"
|
||||||
|
},
|
||||||
|
|
||||||
|
"tools": {
|
||||||
|
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"netcoreapp1.0": {
|
||||||
|
"imports": [
|
||||||
|
"dotnet5.6",
|
||||||
|
"portable-net45+win8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"buildOptions": {
|
||||||
|
"emitEntryPoint": true,
|
||||||
|
"preserveCompilationContext": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"runtimeOptions": {
|
||||||
|
"configProperties": {
|
||||||
|
"System.GC.Server": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"publishOptions": {
|
||||||
|
"include": [
|
||||||
|
"wwwroot",
|
||||||
|
"Views",
|
||||||
|
"Areas/**/Views",
|
||||||
|
"appsettings.json",
|
||||||
|
"web.config"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"scripts": {
|
||||||
|
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
|
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<system.webServer>
|
<system.webServer>
|
22
test/Ocelot.UnitTests/Ocelot.UnitTests.xproj
Normal file
22
test/Ocelot.UnitTests/Ocelot.UnitTests.xproj
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>54e84f1a-e525-4443-96ec-039cbd50c263</ProjectGuid>
|
||||||
|
<RootNamespace>Ocelot.UnitTests</RootNamespace>
|
||||||
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||||
|
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
</Project>
|
19
test/Ocelot.UnitTests/Properties/AssemblyInfo.cs
Normal file
19
test/Ocelot.UnitTests/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
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: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Ocelot.UnitTests")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
|
||||||
|
// 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("54e84f1a-e525-4443-96ec-039cbd50c263")]
|
@ -1,9 +1,9 @@
|
|||||||
using System;
|
using Ocelot.Library.Infrastructure.Responses;
|
||||||
using Ocelot.ApiGateway.Infrastructure.Responses;
|
using Ocelot.Library.Infrastructure.Router;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.ApiGateway.Infrastructure.Router
|
namespace Ocelot.UnitTests
|
||||||
{
|
{
|
||||||
public class RouterTests
|
public class RouterTests
|
||||||
{
|
{
|
36
test/Ocelot.UnitTests/project.json
Normal file
36
test/Ocelot.UnitTests/project.json
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
|
||||||
|
"testRunner": "xunit",
|
||||||
|
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "platform"
|
||||||
|
},
|
||||||
|
"Microsoft.AspNetCore.Mvc": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.Json": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging.Console": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging.Debug": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Http": "1.0.0",
|
||||||
|
"Ocelot.Library": "1.0.0-*",
|
||||||
|
"xunit": "2.1.0",
|
||||||
|
"dotnet-test-xunit": "2.2.0-preview2-build1029",
|
||||||
|
"Shouldly": "2.8.0"
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"netcoreapp1.0": {
|
||||||
|
"imports": [
|
||||||
|
"dotnet5.6",
|
||||||
|
"portable-net45+win8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user