Last active
August 21, 2018 22:05
-
-
Save davidfowl/86d8363f56892180885a54d871d9f95a to your computer and use it in GitHub Desktop.
Microservices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace WebApplication30 | |
{ | |
public class AppController : Controller | |
{ | |
public virtual void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddMvc(); | |
} | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
Configure(app); | |
app.UseMvc(); | |
} | |
protected virtual void Configure(IApplicationBuilder app) | |
{ | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace Microservice | |
{ | |
public class Program : AppController | |
{ | |
[HttpGet("/")] | |
public string Hello() | |
{ | |
return "Hello World"; | |
} | |
public static void Main(string[] args) | |
{ | |
BuildWebHost(args).Run(); | |
} | |
public static IWebHost BuildWebHost(string[] args) => | |
WebHost.CreateDefaultBuilder(args) | |
.UseStartup<Program>() | |
.Build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment