From 6d414c79b49e87dacc52fe6a025acef148f0fedf Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Fri, 13 Oct 2017 22:26:47 -0400 Subject: [PATCH] core 2.0 --- api.tparnell.io.sln | 12 +++--- global.json | 6 --- .../Controllers/ConferenceController.cs | 3 +- .../Controllers/HomeController.cs | 5 +-- .../Controllers/ResumeController.cs | 4 +- .../Controllers/SocialController.cs | 4 +- .../Controllers/WebsitesController.cs | 10 ++--- src/api.tparnell.io/Program.cs | 22 ++++++++++ src/api.tparnell.io/Startup.cs | 19 +++----- src/api.tparnell.io/api.tparnell.io.csproj | 11 +++++ src/api.tparnell.io/api.tparnell.io.xproj | 23 ---------- src/api.tparnell.io/appsettings.json | 12 +++--- src/api.tparnell.io/project.json | 43 ------------------- src/api.tparnell.io/wwwroot/index.html | 3 +- 14 files changed, 64 insertions(+), 113 deletions(-) delete mode 100644 global.json create mode 100644 src/api.tparnell.io/Program.cs create mode 100644 src/api.tparnell.io/api.tparnell.io.csproj delete mode 100644 src/api.tparnell.io/api.tparnell.io.xproj delete mode 100644 src/api.tparnell.io/project.json diff --git a/api.tparnell.io.sln b/api.tparnell.io.sln index 4a6aaee..0e6ead0 100644 --- a/api.tparnell.io.sln +++ b/api.tparnell.io.sln @@ -1,16 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.12 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9EE482C9-26E6-43DF-9C81-A4BE3ED75D67}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{68D81769-33DC-48FA-967A-0E1DB7DC254D}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "api.tparnell.io", "src\api.tparnell.io\api.tparnell.io.xproj", "{C3A3F90B-675C-419E-BC1D-811648F9B396}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "api.tparnell.io", "src\api.tparnell.io\api.tparnell.io.csproj", "{C3A3F90B-675C-419E-BC1D-811648F9B396}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -29,4 +26,7 @@ Global GlobalSection(NestedProjects) = preSolution {C3A3F90B-675C-419E-BC1D-811648F9B396} = {9EE482C9-26E6-43DF-9C81-A4BE3ED75D67} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {73034B9A-E5E3-474B-9B04-8D2839069F37} + EndGlobalSection EndGlobal diff --git a/global.json b/global.json deleted file mode 100644 index e4870b2..0000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": [ "src", "test" ], - "sdk": { - "version": "1.0.0-rc1-final" - } -} diff --git a/src/api.tparnell.io/Controllers/ConferenceController.cs b/src/api.tparnell.io/Controllers/ConferenceController.cs index cb37d18..e640ac9 100644 --- a/src/api.tparnell.io/Controllers/ConferenceController.cs +++ b/src/api.tparnell.io/Controllers/ConferenceController.cs @@ -2,7 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 diff --git a/src/api.tparnell.io/Controllers/HomeController.cs b/src/api.tparnell.io/Controllers/HomeController.cs index 53abe38..f88c79f 100644 --- a/src/api.tparnell.io/Controllers/HomeController.cs +++ b/src/api.tparnell.io/Controllers/HomeController.cs @@ -2,9 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNet.Hosting; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.ApiExplorer; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Hosting; namespace api.tparnell.io.Controllers { diff --git a/src/api.tparnell.io/Controllers/ResumeController.cs b/src/api.tparnell.io/Controllers/ResumeController.cs index b4c66fa..e9d2d32 100644 --- a/src/api.tparnell.io/Controllers/ResumeController.cs +++ b/src/api.tparnell.io/Controllers/ResumeController.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc; +using Microsoft.AspNetCore.Mvc; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 @@ -16,7 +16,7 @@ namespace api.tparnell.io.Controllers { using(var t = new HttpClient()) { - var data = await t.GetAsync("http://resume.tparnell.io/resume.json"); + var data = await t.GetAsync("http://resume.terribledev.io/resume.json"); this.Response.ContentType = data.Content.Headers.ContentType.MediaType; return new FileStreamResult(await data.Content.ReadAsStreamAsync(), data.Content.Headers.ContentType.MediaType); } diff --git a/src/api.tparnell.io/Controllers/SocialController.cs b/src/api.tparnell.io/Controllers/SocialController.cs index 920e4ac..71df515 100644 --- a/src/api.tparnell.io/Controllers/SocialController.cs +++ b/src/api.tparnell.io/Controllers/SocialController.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc; +using Microsoft.AspNetCore.Mvc; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 @@ -14,7 +14,7 @@ namespace api.tparnell.io.Controllers { ["Linkedin"] = "https://www.linkedin.com/in/tommy-parnell-63a72224", ["Twitter"] = "https://twitter.com/TerribleDev", - ["Github"] = "https://github.com/tparnell8" + ["Github"] = "https://github.com/terribledev" }; public IActionResult Index() => new JsonResult(endpoints); diff --git a/src/api.tparnell.io/Controllers/WebsitesController.cs b/src/api.tparnell.io/Controllers/WebsitesController.cs index c28b3a8..ede9503 100644 --- a/src/api.tparnell.io/Controllers/WebsitesController.cs +++ b/src/api.tparnell.io/Controllers/WebsitesController.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc; +using Microsoft.AspNetCore.Mvc; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 @@ -12,10 +12,10 @@ namespace api.tparnell.io.Controllers { private static readonly Dictionary> endpoints = new Dictionary> { - ["AboutMe"] = new List() { "about.tparnell.io", "about.tommyparnell.com" }, - ["Resume"] = new List() { "resume.tparnell.io", "resume.tommyparnell.com" }, + ["AboutMe"] = new List() { "about.terribledev.io", "about.tommyparnell.com" }, + ["Resume"] = new List() { "resume.terribledev.io", "resume.tommyparnell.com" }, ["LetMeLycosThatForYou"] = new List() { "lmltfy.xyz" }, - ["api"] = new List() { "api.tparnell.io" }, + ["api"] = new List() { "api.terribledev.io" }, ["dotnetmashup"] = new List() { "dotnetmashup.azurewebsites.net" } }; @@ -31,7 +31,7 @@ namespace api.tparnell.io.Controllers { return Redirect("http://" + endpoints[id].First()); } - return HttpNotFound(); + return NotFound(); } } } \ No newline at end of file diff --git a/src/api.tparnell.io/Program.cs b/src/api.tparnell.io/Program.cs new file mode 100644 index 0000000..c8082a5 --- /dev/null +++ b/src/api.tparnell.io/Program.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using System; +using System.Collections.Generic; +using System.Text; + +namespace api.tparnell.io +{ + public static class Program + { + public static void Main(string[] args) + { + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseIISIntegration() + .UseStartup() + .Build(); + } +} diff --git a/src/api.tparnell.io/Startup.cs b/src/api.tparnell.io/Startup.cs index 225edd8..f030dcd 100644 --- a/src/api.tparnell.io/Startup.cs +++ b/src/api.tparnell.io/Startup.cs @@ -2,26 +2,22 @@ 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; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Builder; namespace api.tparnell.io { public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - // Set up configuration sources. - var builder = new ConfigurationBuilder() - .AddJsonFile("appsettings.json") - .AddEnvironmentVariables(); - Configuration = builder.Build(); + Configuration = configuration; } - public IConfigurationRoot Configuration { get; set; } + public IConfiguration Configuration { get; set; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) @@ -47,8 +43,6 @@ namespace api.tparnell.io { app.UseExceptionHandler("/Home/Error"); } - - app.UseIISPlatformHandler(); app.UseStaticFiles(); app.UseMvc(routes => { @@ -57,8 +51,5 @@ namespace api.tparnell.io template: "{controller=Home}/{action=Index}/{id?}"); }); } - - // Entry point for the application. - public static void Main(string[] args) => WebApplication.Run(args); } } \ No newline at end of file diff --git a/src/api.tparnell.io/api.tparnell.io.csproj b/src/api.tparnell.io/api.tparnell.io.csproj new file mode 100644 index 0000000..d86a405 --- /dev/null +++ b/src/api.tparnell.io/api.tparnell.io.csproj @@ -0,0 +1,11 @@ + + + + netcoreapp2.0 + + + + + + + diff --git a/src/api.tparnell.io/api.tparnell.io.xproj b/src/api.tparnell.io/api.tparnell.io.xproj deleted file mode 100644 index efeffe1..0000000 --- a/src/api.tparnell.io/api.tparnell.io.xproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - c3a3f90b-675c-419e-bc1d-811648f9b396 - api.tparnell.io - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - - - - - - - - diff --git a/src/api.tparnell.io/appsettings.json b/src/api.tparnell.io/appsettings.json index cc127a8..4670b4b 100644 --- a/src/api.tparnell.io/appsettings.json +++ b/src/api.tparnell.io/appsettings.json @@ -1,10 +1,8 @@ { - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Verbose", - "System": "Information", - "Microsoft": "Information" + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Warning" + } } - } } diff --git a/src/api.tparnell.io/project.json b/src/api.tparnell.io/project.json deleted file mode 100644 index 3a0ba87..0000000 --- a/src/api.tparnell.io/project.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "version": "1.0.0-*", - "webroot": "wwwroot", - "compilationOptions": { - "emitEntryPoint": true - }, - - "dependencies": { - "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final", - "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", - "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final", - "System.Net.Http": "4.0.1-beta-23516" - }, - - "commands": { - "web": "Microsoft.AspNet.Server.Kestrel" - }, - - "frameworks": { - "dnx451": { - } - }, - - "exclude": [ - "wwwroot", - "node_modules" - ], - "publishExclude": [ - "**.user", - "**.vspscc" - ], - "scripts": { - "prepublish": [ ] - } -} \ No newline at end of file diff --git a/src/api.tparnell.io/wwwroot/index.html b/src/api.tparnell.io/wwwroot/index.html index a5bb20c..56f9ae0 100644 --- a/src/api.tparnell.io/wwwroot/index.html +++ b/src/api.tparnell.io/wwwroot/index.html @@ -55,7 +55,8 @@ function go() { $('#go').prop('disabled', true); $.ajax({ - url: $('#urldata').val() + url: $('#urldata').val(), + dataType: 'json' }) .done(function (data) { var result;