mirror of
https://github.com/chsakell/aspnet-core-signalr-angular.git
synced 2025-12-22 17:27:48 +00:00
add HomeController
This commit is contained in:
21
Controllers/HomeController.cs
Normal file
21
Controllers/HomeController.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ChatLe.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
static ILogger _logger;
|
||||
public HomeController(ILoggerFactory factory)
|
||||
{
|
||||
if (_logger == null)
|
||||
_logger = factory.CreateLogger("Unhandled Error");
|
||||
}
|
||||
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,12 @@ namespace LiveGameFeed
|
||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||
loggerFactory.AddDebug();
|
||||
|
||||
app.UseMvc();
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
name: "default",
|
||||
template: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
app.UseSignalR();
|
||||
}
|
||||
}
|
||||
|
||||
10
Views/Home/Index.cshtml
Normal file
10
Views/Home/Index.cshtml
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello from home controller!</h1>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user