From eb49e241b485da662aab2fdfbf09651241e87c90 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Thu, 21 Apr 2016 20:51:38 -0400 Subject: [PATCH] use v4 until rc2 --- ProgrammerExcusesApi.sln | 20 +- .../App_Start/SwaggerConfig.cs | 244 ++++++++++++++++++ .../App_Start/WebApiConfig.cs | 24 ++ .../Controllers/HomeController.cs | 21 ++ src/ProgrammerExcuses.Api/Global.asax | 1 + src/ProgrammerExcuses.Api/Global.asax.cs | 17 ++ src/ProgrammerExcuses.Api/Models/Result.cs | 13 + .../ProgrammerExcuses.Api.csproj | 150 +++++++++++ .../Properties/AssemblyInfo.cs | 35 +++ src/ProgrammerExcuses.Api/Web.Debug.config | 30 +++ src/ProgrammerExcuses.Api/Web.Release.config | 31 +++ src/ProgrammerExcuses.Api/Web.config | 37 +++ src/ProgrammerExcuses.Api/packages.config | 14 + .../Controllers/HomeController.cs | 27 -- .../ProgrammerExcusesApi.xproj | 18 -- .../tparnellexcuseapi-publish.ps1 | 101 -------- .../Properties/launchSettings.json | 26 -- src/ProgrammerExcusesApi/Startup.cs | 49 ---- src/ProgrammerExcusesApi/appsettings.json | 10 - src/ProgrammerExcusesApi/project.json | 36 --- src/ProgrammerExcusesApi/wwwroot/web.config | 9 - 21 files changed, 622 insertions(+), 291 deletions(-) create mode 100644 src/ProgrammerExcuses.Api/App_Start/SwaggerConfig.cs create mode 100644 src/ProgrammerExcuses.Api/App_Start/WebApiConfig.cs create mode 100644 src/ProgrammerExcuses.Api/Controllers/HomeController.cs create mode 100644 src/ProgrammerExcuses.Api/Global.asax create mode 100644 src/ProgrammerExcuses.Api/Global.asax.cs create mode 100644 src/ProgrammerExcuses.Api/Models/Result.cs create mode 100644 src/ProgrammerExcuses.Api/ProgrammerExcuses.Api.csproj create mode 100644 src/ProgrammerExcuses.Api/Properties/AssemblyInfo.cs create mode 100644 src/ProgrammerExcuses.Api/Web.Debug.config create mode 100644 src/ProgrammerExcuses.Api/Web.Release.config create mode 100644 src/ProgrammerExcuses.Api/Web.config create mode 100644 src/ProgrammerExcuses.Api/packages.config delete mode 100644 src/ProgrammerExcusesApi/Controllers/HomeController.cs delete mode 100644 src/ProgrammerExcusesApi/ProgrammerExcusesApi.xproj delete mode 100644 src/ProgrammerExcusesApi/Properties/PublishProfiles/tparnellexcuseapi-publish.ps1 delete mode 100644 src/ProgrammerExcusesApi/Properties/launchSettings.json delete mode 100644 src/ProgrammerExcusesApi/Startup.cs delete mode 100644 src/ProgrammerExcusesApi/appsettings.json delete mode 100644 src/ProgrammerExcusesApi/project.json delete mode 100644 src/ProgrammerExcusesApi/wwwroot/web.config diff --git a/ProgrammerExcusesApi.sln b/ProgrammerExcusesApi.sln index 1d5728e..83823fb 100644 --- a/ProgrammerExcusesApi.sln +++ b/ProgrammerExcusesApi.sln @@ -3,14 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.24720.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3542AB75-23F7-4A78-B403-850A226D0F15}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{45C68F8A-EB5B-4F28-8A8E-90BB722D1E0C}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ProgrammerExcusesApi", "src\ProgrammerExcusesApi\ProgrammerExcusesApi.xproj", "{13C0906F-3A74-4AFE-87E0-363392FDCBD6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProgrammerExcuses.Api", "src\ProgrammerExcuses.Api\ProgrammerExcuses.Api.csproj", "{F520A772-0999-4B51-88C6-13D7ABF9803B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -18,15 +11,12 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {13C0906F-3A74-4AFE-87E0-363392FDCBD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {13C0906F-3A74-4AFE-87E0-363392FDCBD6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {13C0906F-3A74-4AFE-87E0-363392FDCBD6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {13C0906F-3A74-4AFE-87E0-363392FDCBD6}.Release|Any CPU.Build.0 = Release|Any CPU + {F520A772-0999-4B51-88C6-13D7ABF9803B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F520A772-0999-4B51-88C6-13D7ABF9803B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F520A772-0999-4B51-88C6-13D7ABF9803B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F520A772-0999-4B51-88C6-13D7ABF9803B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {13C0906F-3A74-4AFE-87E0-363392FDCBD6} = {3542AB75-23F7-4A78-B403-850A226D0F15} - EndGlobalSection EndGlobal diff --git a/src/ProgrammerExcuses.Api/App_Start/SwaggerConfig.cs b/src/ProgrammerExcuses.Api/App_Start/SwaggerConfig.cs new file mode 100644 index 0000000..0693fd8 --- /dev/null +++ b/src/ProgrammerExcuses.Api/App_Start/SwaggerConfig.cs @@ -0,0 +1,244 @@ +using System.Globalization; +using System.Linq; +using System.Web.Http; +using System.Web.Http.Description; +using Swashbuckle.Application; +using Swashbuckle.Swagger; +using WebActivatorEx; +using ProgrammerExcuses.Api; + +[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")] + +namespace ProgrammerExcuses.Api +{ + public class SwaggerConfig + { + public static void Register() + { + var thisAssembly = typeof(SwaggerConfig).Assembly; + + GlobalConfiguration.Configuration + .EnableSwagger(c => + { + // By default, the service root url is inferred from the request used to access the docs. + // However, there may be situations (e.g. proxy and load-balanced environments) where this does not + // resolve correctly. You can workaround this by providing your own code to determine the root URL. + // + //c.RootUrl(req => GetRootUrlFromAppConfig()); + + // If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access + // the docs is taken as the default. If your API supports multiple schemes and you want to be explicit + // about them, you can use the "Schemes" option as shown below. + // + //c.Schemes(new[] { "http", "https" }); + + // Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to + // hold additional metadata for an API. Version and title are required but you can also provide + // additional fields by chaining methods off SingleApiVersion. + // + c.SingleApiVersion("v1", "ProgrammerExcuses.Api"); + + // If your API has multiple versions, use "MultipleApiVersions" instead of "SingleApiVersion". + // In this case, you must provide a lambda that tells Swashbuckle which actions should be + // included in the docs for a given API version. Like "SingleApiVersion", each call to "Version" + // returns an "Info" builder so you can provide additional metadata per API version. + // + //c.MultipleApiVersions( + // (apiDesc, targetApiVersion) => ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), + // (vc) => + // { + // vc.Version("v2", "Swashbuckle Dummy API V2"); + // vc.Version("v1", "Swashbuckle Dummy API V1"); + // }); + + // You can use "BasicAuth", "ApiKey" or "OAuth2" options to describe security schemes for the API. + // See https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md for more details. + // NOTE: These only define the schemes and need to be coupled with a corresponding "security" property + // at the document or operation level to indicate which schemes are required for an operation. To do this, + // you'll need to implement a custom IDocumentFilter and/or IOperationFilter to set these properties + // according to your specific authorization implementation + // + //c.BasicAuth("basic") + // .Description("Basic HTTP Authentication"); + // + //c.ApiKey("apiKey") + // .Description("API Key Authentication") + // .Name("apiKey") + // .In("header"); + // + //c.OAuth2("oauth2") + // .Description("OAuth2 Implicit Grant") + // .Flow("implicit") + // .AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog") + // //.TokenUrl("https://tempuri.org/token") + // .Scopes(scopes => + // { + // scopes.Add("read", "Read access to protected resources"); + // scopes.Add("write", "Write access to protected resources"); + // }); + + // Set this flag to omit descriptions for any actions decorated with the Obsolete attribute + //c.IgnoreObsoleteActions(); + + // Each operation be assigned one or more tags which are then used by consumers for various reasons. + // For example, the swagger-ui groups operations according to the first tag of each operation. + // By default, this will be controller name but you can use the "GroupActionsBy" option to + // override with any value. + // + //c.GroupActionsBy(apiDesc => apiDesc.HttpMethod.ToString()); + + // You can also specify a custom sort order for groups (as defined by "GroupActionsBy") to dictate + // the order in which operations are listed. For example, if the default grouping is in place + // (controller name) and you specify a descending alphabetic sort order, then actions from a + // ProductsController will be listed before those from a CustomersController. This is typically + // used to customize the order of groupings in the swagger-ui. + // + //c.OrderActionGroupsBy(new DescendingAlphabeticComparer()); + + // Swashbuckle makes a best attempt at generating Swagger compliant JSON schemas for the various types + // exposed in your API. However, there may be occasions when more control of the output is needed. + // This is supported through the "MapType" and "SchemaFilter" options: + // + // Use the "MapType" option to override the Schema generation for a specific type. + // It should be noted that the resulting Schema will be placed "inline" for any applicable Operations. + // While Swagger 2.0 supports inline definitions for "all" Schema types, the swagger-ui tool does not. + // It expects "complex" Schemas to be defined separately and referenced. For this reason, you should only + // use the "MapType" option when the resulting Schema is a primitive or array type. If you need to alter a + // complex Schema, use a Schema filter. + // + //c.MapType(() => new Schema { type = "integer", format = "int32" }); + // + // If you want to post-modify "complex" Schemas once they've been generated, across the board or for a + // specific type, you can wire up one or more Schema filters. + // + //c.SchemaFilter(); + + // Set this flag to omit schema property descriptions for any type properties decorated with the + // Obsolete attribute + //c.IgnoreObsoleteProperties(); + + // In a Swagger 2.0 document, complex types are typically declared globally and referenced by unique + // Schema Id. By default, Swashbuckle does NOT use the full type name in Schema Ids. In most cases, this + // works well because it prevents the "implementation detail" of type namespaces from leaking into your + // Swagger docs and UI. However, if you have multiple types in your API with the same class name, you'll + // need to opt out of this behavior to avoid Schema Id conflicts. + // + //c.UseFullTypeNameInSchemaIds(); + + // In accordance with the built in JsonSerializer, Swashbuckle will, by default, describe enums as integers. + // You can change the serializer behavior by configuring the StringToEnumConverter globally or for a given + // enum type. Swashbuckle will honor this change out-of-the-box. However, if you use a different + // approach to serialize enums as strings, you can also force Swashbuckle to describe them as strings. + // + //c.DescribeAllEnumsAsStrings(); + + // Similar to Schema filters, Swashbuckle also supports Operation and Document filters: + // + // Post-modify Operation descriptions once they've been generated by wiring up one or more + // Operation filters. + // + //c.OperationFilter(); + // + // If you've defined an OAuth2 flow as described above, you could use a custom filter + // to inspect some attribute on each action and infer which (if any) OAuth2 scopes are required + // to execute the operation + // + //c.OperationFilter(); + // + // Set filter to eliminate duplicate operation ids from being generated + // when there are multiple operations with the same verb in the API. + // + c.OperationFilter(); + + // Post-modify the entire Swagger document by wiring up one or more Document filters. + // This gives full control to modify the final SwaggerDocument. You should have a good understanding of + // the Swagger 2.0 spec. - https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md + // before using this option. + // + //c.DocumentFilter(); + + // If you annonate Controllers and API Types with + // Xml comments (http://msdn.microsoft.com/en-us/library/b2s063f7(v=vs.110).aspx), you can incorporate + // those comments into the generated docs and UI. You can enable this by providing the path to one or + // more Xml comment files. + // + //c.IncludeXmlComments(GetXmlCommentsPath()); + + // In contrast to WebApi, Swagger 2.0 does not include the query string component when mapping a URL + // to an action. As a result, Swashbuckle will raise an exception if it encounters multiple actions + // with the same path (sans query string) and HTTP method. You can workaround this by providing a + // custom strategy to pick a winner or merge the descriptions for the purposes of the Swagger docs + // + //c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); + // ***** Uncomment the following to enable the swagger UI ***** + /* + }) + .EnableSwaggerUi(c => + { + */ + // Use the "InjectStylesheet" option to enrich the UI with one or more additional CSS stylesheets. + // The file must be included in your project as an "Embedded Resource", and then the resource's + // "Logical Name" is passed to the method as shown below. + // + //c.InjectStylesheet(containingAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css"); + + // Use the "InjectJavaScript" option to invoke one or more custom JavaScripts after the swagger-ui + // has loaded. The file must be included in your project as an "Embedded Resource", and then the resource's + // "Logical Name" is passed to the method as shown above. + // + //c.InjectJavaScript(thisAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testScript1.js"); + + // The swagger-ui renders boolean data types as a dropdown. By default, it provides "true" and "false" + // strings as the possible choices. You can use this option to change these to something else, + // for example 0 and 1. + // + //c.BooleanValues(new[] { "0", "1" }); + + // Use this option to control how the Operation listing is displayed. + // It can be set to "None" (default), "List" (shows operations for each resource), + // or "Full" (fully expanded: shows operations and their details). + // + //c.DocExpansion(DocExpansion.List); + + // Use the CustomAsset option to provide your own version of assets used in the swagger-ui. + // It's typically used to instruct Swashbuckle to return your version instead of the default + // when a request is made for "index.html". As with all custom content, the file must be included + // in your project as an "Embedded Resource", and then the resource's "Logical Name" is passed to + // the method as shown below. + // + //c.CustomAsset("index", containingAssembly, "YourWebApiProject.SwaggerExtensions.index.html"); + + // If your API has multiple versions and you've applied the MultipleApiVersions setting + // as described above, you can also enable a select box in the swagger-ui, that displays + // a discovery URL for each version. This provides a convenient way for users to browse documentation + // for different API versions. + // + //c.EnableDiscoveryUrlSelector(); + + // If your API supports the OAuth2 Implicit flow, and you've described it correctly, according to + // the Swagger 2.0 specification, you can enable UI support as shown below. + // + //c.EnableOAuth2Support("test-client-id", "test-realm", "Swagger UI"); + }); + } + } + + internal class IncludeParameterNamesInOperationIdFilter : IOperationFilter + { + public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription) + { + if(operation.parameters != null) + { + // Select the capitalized parameter names + var parameters = operation.parameters.Select( + p => CultureInfo.InvariantCulture.TextInfo.ToTitleCase(p.name)); + + // Set the operation id to match the format "OperationByParam1AndParam2" + operation.operationId = string.Format( + "{0}By{1}", + operation.operationId, + string.Join("And", parameters)); + } + } + } +} \ No newline at end of file diff --git a/src/ProgrammerExcuses.Api/App_Start/WebApiConfig.cs b/src/ProgrammerExcuses.Api/App_Start/WebApiConfig.cs new file mode 100644 index 0000000..2b00f7d --- /dev/null +++ b/src/ProgrammerExcuses.Api/App_Start/WebApiConfig.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web.Http; + +namespace ProgrammerExcuses.Api +{ + public static class WebApiConfig + { + public static void Register(HttpConfiguration config) + { + // Web API configuration and services + + // Web API routes + config.MapHttpAttributeRoutes(); + + config.Routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: "api/{controller}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + } + } +} diff --git a/src/ProgrammerExcuses.Api/Controllers/HomeController.cs b/src/ProgrammerExcuses.Api/Controllers/HomeController.cs new file mode 100644 index 0000000..9015a91 --- /dev/null +++ b/src/ProgrammerExcuses.Api/Controllers/HomeController.cs @@ -0,0 +1,21 @@ +using AngleSharp; +using ProgrammerExcuses.Api.Models; +using System.Linq; +using System.Threading.Tasks; +using System.Web.Http; + +namespace ProgrammerExcuses.Api.Controllers +{ + public class HomeController : ApiController + { + public async Task Get() + { + var config = AngleSharp.Configuration.Default.WithDefaultLoader(); + var address = "http://programmingexcuses.com/"; + var document = await BrowsingContext.New(config).OpenAsync(address); + var cells = document.QuerySelectorAll("a"); + var data = cells.First().TextContent; + return new Result() { Content = data, Title = document.Title }; + } + } +} \ No newline at end of file diff --git a/src/ProgrammerExcuses.Api/Global.asax b/src/ProgrammerExcuses.Api/Global.asax new file mode 100644 index 0000000..a74e92c --- /dev/null +++ b/src/ProgrammerExcuses.Api/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="ProgrammerExcuses.Api.WebApiApplication" Language="C#" %> diff --git a/src/ProgrammerExcuses.Api/Global.asax.cs b/src/ProgrammerExcuses.Api/Global.asax.cs new file mode 100644 index 0000000..f5c7ddf --- /dev/null +++ b/src/ProgrammerExcuses.Api/Global.asax.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; +using System.Web.Routing; + +namespace ProgrammerExcuses.Api +{ + public class WebApiApplication : System.Web.HttpApplication + { + protected void Application_Start() + { + GlobalConfiguration.Configure(WebApiConfig.Register); + } + } +} diff --git a/src/ProgrammerExcuses.Api/Models/Result.cs b/src/ProgrammerExcuses.Api/Models/Result.cs new file mode 100644 index 0000000..a9448e6 --- /dev/null +++ b/src/ProgrammerExcuses.Api/Models/Result.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace ProgrammerExcuses.Api.Models +{ + public class Result + { + public string Content { get; set; } + public string Title { get; set; } + } +} \ No newline at end of file diff --git a/src/ProgrammerExcuses.Api/ProgrammerExcuses.Api.csproj b/src/ProgrammerExcuses.Api/ProgrammerExcuses.Api.csproj new file mode 100644 index 0000000..29c7d0c --- /dev/null +++ b/src/ProgrammerExcuses.Api/ProgrammerExcuses.Api.csproj @@ -0,0 +1,150 @@ + + + + + Debug + AnyCPU + + 2.0 + {F520A772-0999-4B51-88C6-13D7ABF9803B} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + ProgrammerExcuses.Api + ProgrammerExcuses.Api + v4.5.2 + true + + + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\..\packages\AngleSharp.0.9.5\lib\net45\AngleSharp.dll + True + + + + True + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + ..\packages\Swashbuckle.Core.5.0.0\lib\net40\Swashbuckle.Core.dll + + + ..\packages\System.IdentityModel.Tokens.Jwt.4.0.0\lib\net45\System.IdentityModel.Tokens.Jwt.dll + + + + + + + + + + + + + + + + + + + + + + + + + ..\packages\WebActivatorEx.2.0.6\lib\net40\WebActivatorEx.dll + + + ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll + + + + + + + + + + + + + Global.asax + + + + + + + Web.config + + + Web.config + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 32962 + / + http://localhost:32962/ + False + False + + + False + + + + + + \ No newline at end of file diff --git a/src/ProgrammerExcuses.Api/Properties/AssemblyInfo.cs b/src/ProgrammerExcuses.Api/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1aa3199 --- /dev/null +++ b/src/ProgrammerExcuses.Api/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +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("ProgrammerExcuses.Api")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProgrammerExcuses.Api")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[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("55acf0ee-0bc3-499b-8d95-4cb7bd0705ec")] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/ProgrammerExcuses.Api/Web.Debug.config b/src/ProgrammerExcuses.Api/Web.Debug.config new file mode 100644 index 0000000..f7c5612 --- /dev/null +++ b/src/ProgrammerExcuses.Api/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/ProgrammerExcuses.Api/Web.Release.config b/src/ProgrammerExcuses.Api/Web.Release.config new file mode 100644 index 0000000..52c6bbe --- /dev/null +++ b/src/ProgrammerExcuses.Api/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/ProgrammerExcuses.Api/Web.config b/src/ProgrammerExcuses.Api/Web.config new file mode 100644 index 0000000..9b973f7 --- /dev/null +++ b/src/ProgrammerExcuses.Api/Web.config @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ProgrammerExcuses.Api/packages.config b/src/ProgrammerExcuses.Api/packages.config new file mode 100644 index 0000000..40cdbc8 --- /dev/null +++ b/src/ProgrammerExcuses.Api/packages.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ProgrammerExcusesApi/Controllers/HomeController.cs b/src/ProgrammerExcusesApi/Controllers/HomeController.cs deleted file mode 100644 index 3b03d80..0000000 --- a/src/ProgrammerExcusesApi/Controllers/HomeController.cs +++ /dev/null @@ -1,27 +0,0 @@ -using AngleSharp; -using Microsoft.AspNet.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 - -namespace ProgrammerExcusesApi.Controllers -{ - [Route("api/[Controller]")] - public class HomeController : Controller - { - // GET: // - - public async Task Index() - { - var config = Configuration.Default.WithDefaultLoader(); - var address = "http://programmingexcuses.com/"; - var document = await BrowsingContext.New(config).OpenAsync(address); - var cells = document.QuerySelectorAll("a"); - var data = cells.First().TextContent; - return new JsonResult(new { content = data, title = document.Title }); - } - } -} \ No newline at end of file diff --git a/src/ProgrammerExcusesApi/ProgrammerExcusesApi.xproj b/src/ProgrammerExcusesApi/ProgrammerExcusesApi.xproj deleted file mode 100644 index 8ad0632..0000000 --- a/src/ProgrammerExcusesApi/ProgrammerExcusesApi.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 13c0906f-3a74-4afe-87e0-363392fdcbd6 - ProgrammerExcusesApi - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - - - diff --git a/src/ProgrammerExcusesApi/Properties/PublishProfiles/tparnellexcuseapi-publish.ps1 b/src/ProgrammerExcusesApi/Properties/PublishProfiles/tparnellexcuseapi-publish.ps1 deleted file mode 100644 index f0ce721..0000000 --- a/src/ProgrammerExcusesApi/Properties/PublishProfiles/tparnellexcuseapi-publish.ps1 +++ /dev/null @@ -1,101 +0,0 @@ -[cmdletbinding(SupportsShouldProcess=$true)] -param($publishProperties, $packOutput, $nugetUrl) - -# to learn more about this file visit http://go.microsoft.com/fwlink/?LinkId=524327 -$publishModuleVersion = '1.0.1' -function Get-VisualStudio2015InstallPath{ - [cmdletbinding()] - param() - process{ - $keysToCheck = @('hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0', - 'hklm:\SOFTWARE\Microsoft\VisualStudio\14.0', - 'hklm:\SOFTWARE\Wow6432Node\Microsoft\VWDExpress\14.0', - 'hklm:\SOFTWARE\Microsoft\VWDExpress\14.0' - ) - [string]$vsInstallPath=$null - - foreach($keyToCheck in $keysToCheck){ - if(Test-Path $keyToCheck){ - $vsInstallPath = (Get-itemproperty $keyToCheck -Name InstallDir -ErrorAction SilentlyContinue | select -ExpandProperty InstallDir -ErrorAction SilentlyContinue) - } - - if($vsInstallPath){ - break; - } - } - - $vsInstallPath - } -} - -$vsInstallPath = Get-VisualStudio2015InstallPath -$publishModulePath = "{0}Extensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f $vsInstallPath, $publishModuleVersion - -if(!(Test-Path $publishModulePath)){ - $publishModulePath = "{0}VWDExpressExtensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f $vsInstallPath, $publishModuleVersion -} - -$defaultPublishSettings = New-Object psobject -Property @{ - LocalInstallDir = $publishModulePath -} - -function Enable-PackageDownloader{ - [cmdletbinding()] - param( - $toolsDir = "$env:LOCALAPPDATA\Microsoft\Web Tools\Publish\package-downloader-$publishModuleVersion\", - $pkgDownloaderDownloadUrl = 'http://go.microsoft.com/fwlink/?LinkId=524325') # package-downloader.psm1 - process{ - if(get-module package-downloader){ - remove-module package-downloader | Out-Null - } - - if(!(get-module package-downloader)){ - if(!(Test-Path $toolsDir)){ New-Item -Path $toolsDir -ItemType Directory -WhatIf:$false } - - $expectedPath = (Join-Path ($toolsDir) 'package-downloader.psm1') - if(!(Test-Path $expectedPath)){ - 'Downloading [{0}] to [{1}]' -f $pkgDownloaderDownloadUrl,$expectedPath | Write-Verbose - (New-Object System.Net.WebClient).DownloadFile($pkgDownloaderDownloadUrl, $expectedPath) - } - - if(!$expectedPath){throw ('Unable to download package-downloader.psm1')} - - 'importing module [{0}]' -f $expectedPath | Write-Output - Import-Module $expectedPath -DisableNameChecking -Force - } - } -} - -function Enable-PublishModule{ - [cmdletbinding()] - param() - process{ - if(get-module publish-module){ - remove-module publish-module | Out-Null - } - - if(!(get-module publish-module)){ - $localpublishmodulepath = Join-Path $defaultPublishSettings.LocalInstallDir 'publish-module.psm1' - if(Test-Path $localpublishmodulepath){ - 'importing module [publish-module="{0}"] from local install dir' -f $localpublishmodulepath | Write-Verbose - Import-Module $localpublishmodulepath -DisableNameChecking -Force - $true - } - } - } -} - -try{ - - if (!(Enable-PublishModule)){ - Enable-PackageDownloader - Enable-NuGetModule -name 'publish-module' -version $publishModuleVersion -nugetUrl $nugetUrl - } - - 'Calling Publish-AspNet' | Write-Verbose - # call Publish-AspNet to perform the publish operation - Publish-AspNet -publishProperties $publishProperties -packOutput $packOutput -} -catch{ - "An error occurred during publish.`n{0}" -f $_.Exception.Message | Write-Error -} \ No newline at end of file diff --git a/src/ProgrammerExcusesApi/Properties/launchSettings.json b/src/ProgrammerExcusesApi/Properties/launchSettings.json deleted file mode 100644 index 75ca6e8..0000000 --- a/src/ProgrammerExcusesApi/Properties/launchSettings.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:29549/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "api/values", - "environmentVariables": { - "Hosting:Environment": "Development" - } - }, - "web": { - "commandName": "web", - "environmentVariables": { - "Hosting:Environment": "Development" - } - } - } -} \ No newline at end of file diff --git a/src/ProgrammerExcusesApi/Startup.cs b/src/ProgrammerExcusesApi/Startup.cs deleted file mode 100644 index 678d96a..0000000 --- a/src/ProgrammerExcusesApi/Startup.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace ProgrammerExcusesApi -{ - public class Startup - { - public Startup(IHostingEnvironment env) - { - // Set up configuration sources. - var builder = new ConfigurationBuilder() - .AddJsonFile("appsettings.json") - .AddEnvironmentVariables(); - Configuration = builder.Build(); - } - - public IConfigurationRoot Configuration { get; set; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - // Add framework services. - services.AddMvc(); - } - - // 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) - { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - - app.UseIISPlatformHandler(); - - app.UseStaticFiles(); - - app.UseMvc(); - } - - // Entry point for the application. - public static void Main(string[] args) => WebApplication.Run(args); - } -} diff --git a/src/ProgrammerExcusesApi/appsettings.json b/src/ProgrammerExcusesApi/appsettings.json deleted file mode 100644 index cc127a8..0000000 --- a/src/ProgrammerExcusesApi/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Verbose", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/src/ProgrammerExcusesApi/project.json b/src/ProgrammerExcusesApi/project.json deleted file mode 100644 index 352eedb..0000000 --- a/src/ProgrammerExcusesApi/project.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, - - "dependencies": { - "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", - "Microsoft.AspNet.Mvc": "6.0.0-rc1-final", - "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", - "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final", - "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final", - "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final", - "Microsoft.Extensions.Logging": "1.0.0-rc1-final", - "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final", - "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final", - "AngleSharp": "0.9.5" - }, - - "commands": { - "web": "Microsoft.AspNet.Server.Kestrel" - }, - - "frameworks": { - "dnx461": { } - }, - - "exclude": [ - "wwwroot", - "node_modules" - ], - "publishExclude": [ - "**.user", - "**.vspscc" - ] -} \ No newline at end of file diff --git a/src/ProgrammerExcusesApi/wwwroot/web.config b/src/ProgrammerExcusesApi/wwwroot/web.config deleted file mode 100644 index 8485f67..0000000 --- a/src/ProgrammerExcusesApi/wwwroot/web.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - -