Skip to content

Commit

Permalink
add controller
Browse files Browse the repository at this point in the history
  • Loading branch information
nopara73 committed Sep 24, 2024
1 parent ebf60d6 commit d30c0be
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions LongevityWorldCup.Website/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Mvc;

namespace LongevityWorldCup.Website.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class HomeController : Controller
{
[HttpGet("join")]
public IActionResult JoinGame()
{
// Return the static index.html file from wwwroot
// This is just a test
return PhysicalFile(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html"), "text/html");
}
}
}
5 changes: 5 additions & 0 deletions LongevityWorldCup.Website/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ <h2 id="athleteName"></h2>
function getRandomAge() {
return Math.floor(Math.random() * (80 - 40 + 1)) + 40;
}

document.querySelector('.join-game').addEventListener('click', function () {
window.location.href = `${window.location.origin}/api/home/join`;
});

</script>
</body>
</html>

0 comments on commit d30c0be

Please sign in to comment.