Skip to content

Instantly share code, notes, and snippets.

@lucassarcanjo
Last active March 10, 2021 02:30
Show Gist options
  • Save lucassarcanjo/2fdc419bbb8b3cad347fab3f71a9b19b to your computer and use it in GitHub Desktop.
Save lucassarcanjo/2fdc419bbb8b3cad347fab3f71a9b19b to your computer and use it in GitHub Desktop.
using LiveChat.Hubs;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace LiveChat
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSignalR();
services.AddHealthChecks();
services.AddControllers();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapHealthChecks("/health");
endpoints.MapHub<ChatHub>("/hubs/chat");
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment