From 1965bcfc7770c7df7d5bf5519ca3fccb22ec46a4 Mon Sep 17 00:00:00 2001 From: bhelms Date: Mon, 3 Jul 2017 14:09:46 -0500 Subject: [PATCH] Added the orchestration project --- .../CapCom.Orchestration.csproj | 17 +++++++ .../Controllers/ValuesController.cs | 44 +++++++++++++++++++ CapCom.Orchestration/Program.cs | 25 +++++++++++ CapCom.Orchestration/Startup.cs | 43 ++++++++++++++++++ .../appsettings.Development.json | 10 +++++ CapCom.Orchestration/appsettings.json | 8 ++++ 6 files changed, 147 insertions(+) create mode 100755 CapCom.Orchestration/CapCom.Orchestration.csproj create mode 100755 CapCom.Orchestration/Controllers/ValuesController.cs create mode 100755 CapCom.Orchestration/Program.cs create mode 100755 CapCom.Orchestration/Startup.cs create mode 100755 CapCom.Orchestration/appsettings.Development.json create mode 100755 CapCom.Orchestration/appsettings.json diff --git a/CapCom.Orchestration/CapCom.Orchestration.csproj b/CapCom.Orchestration/CapCom.Orchestration.csproj new file mode 100755 index 0000000..72b398f --- /dev/null +++ b/CapCom.Orchestration/CapCom.Orchestration.csproj @@ -0,0 +1,17 @@ + + + + netcoreapp1.1 + + + + + + + + + + + + + diff --git a/CapCom.Orchestration/Controllers/ValuesController.cs b/CapCom.Orchestration/Controllers/ValuesController.cs new file mode 100755 index 0000000..4735c01 --- /dev/null +++ b/CapCom.Orchestration/Controllers/ValuesController.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace CapCom.Orchestration.Controllers +{ + [Route("api/[controller]")] + public class ValuesController : Controller + { + // GET api/values + [HttpGet] + public IEnumerable Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api/values/5 + [HttpGet("{id}")] + public string Get(int id) + { + return "value"; + } + + // POST api/values + [HttpPost] + public void Post([FromBody]string value) + { + } + + // PUT api/values/5 + [HttpPut("{id}")] + public void Put(int id, [FromBody]string value) + { + } + + // DELETE api/values/5 + [HttpDelete("{id}")] + public void Delete(int id) + { + } + } +} diff --git a/CapCom.Orchestration/Program.cs b/CapCom.Orchestration/Program.cs new file mode 100755 index 0000000..bf97fa5 --- /dev/null +++ b/CapCom.Orchestration/Program.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; + +namespace CapCom.Orchestration +{ + public class Program + { + public static void Main(string[] args) + { + var host = new WebHostBuilder() + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIISIntegration() + .UseStartup() + .Build(); + + host.Run(); + } + } +} diff --git a/CapCom.Orchestration/Startup.cs b/CapCom.Orchestration/Startup.cs new file mode 100755 index 0000000..c1219a8 --- /dev/null +++ b/CapCom.Orchestration/Startup.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace CapCom.Orchestration +{ + public class Startup + { + public Startup(IHostingEnvironment env) + { + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables(); + Configuration = builder.Build(); + } + + public IConfigurationRoot Configuration { get; } + + // 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.UseMvc(); + } + } +} diff --git a/CapCom.Orchestration/appsettings.Development.json b/CapCom.Orchestration/appsettings.Development.json new file mode 100755 index 0000000..f334029 --- /dev/null +++ b/CapCom.Orchestration/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/CapCom.Orchestration/appsettings.json b/CapCom.Orchestration/appsettings.json new file mode 100755 index 0000000..5766595 --- /dev/null +++ b/CapCom.Orchestration/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Warning" + } + } +}