mirror of
https://github.com/yawaflua/WebSockets.git
synced 2026-02-04 14:04:11 +02:00
Create project files
This commit is contained in:
42
Examples/Program.cs
Normal file
42
Examples/Program.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using yawaflua.WebSockets;
|
||||
|
||||
namespace Examples;
|
||||
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
await Host.CreateDefaultBuilder(args)
|
||||
.ConfigureLogging(k => k.AddConsole().AddDebug())
|
||||
.ConfigureWebHost(k =>
|
||||
{
|
||||
k.UseKestrel(l => l.ListenAnyIP(80));
|
||||
k.UseStartup<Startup>();
|
||||
})
|
||||
.RunConsoleAsync();
|
||||
}
|
||||
}
|
||||
|
||||
internal class Startup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.SettingUpWebSockets();
|
||||
services.AddRouting();
|
||||
services.AddHttpLogging();
|
||||
services.AddSingleton<TestWebSocketServer>();
|
||||
services.AddSingleton<ChatController>();
|
||||
services.AddScoped<IConfiguration>(k => new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json", true)
|
||||
.Build());
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.ConnectWebSockets();
|
||||
app.UseRouting();
|
||||
app.UseHttpLogging();
|
||||
app.UseWelcomePage();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user