add HomeController

This commit is contained in:
chsakell
2016-09-26 09:53:59 +03:00
parent decb0e5bea
commit 935496603a
3 changed files with 37 additions and 1 deletions

View 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();
}
}
}

View File

@@ -39,7 +39,12 @@ namespace LiveGameFeed
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug(); loggerFactory.AddDebug();
app.UseMvc(); app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
app.UseSignalR(); app.UseSignalR();
} }
} }

10
Views/Home/Index.cshtml Normal file
View 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>