private static async Task Main() { // create application using var app = new Application(); KitchenSinkPage.PublishMugImage(app); app.PublishPage("/", () => new KitchenSinkPage()); app.PublishPage("/upload", () => new UploadFilePage()); app.PublishPage("/server", () => new ServerEventsPage()); // start application await app.Start(new StartServerOptions { Port = 8182 }); Console.WriteLine("Listening on http://localhost:8182/"); LaraUI.LaunchBrowser("http://localhost:8182"); // wait for shutdown await app.WaitForShutdown(); }
public static async Task Main() { // create and start application const int port = 8182; using var app = new Application(); app.PublishPage("/", () => new HttpContextExample()); await app.Start(new StartServerOptions { Port = port }); // print address on console (set project's output type to WinExe to avoid console) var address = $"http://localhost:{port}"; Console.WriteLine($"Listening on {address}/"); // helper function to launch browser (comment out as needed) LaraUI.LaunchBrowser(address); // wait for ASP.NET Core shutdown await app.WaitForShutdown(); }