mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 10:08:57 +00:00
25 lines
676 B
C#
Executable File
25 lines
676 B
C#
Executable File
using System.Threading.Tasks;
|
|
using Microsoft.AspNet.Mvc;
|
|
using Microsoft.AspNet.NodeServices.React;
|
|
|
|
namespace ReactExample.Controllers
|
|
{
|
|
public class HomeController : Controller
|
|
{
|
|
public async Task<IActionResult> Index(int pageIndex)
|
|
{
|
|
ViewData["ReactOutput"] = await ReactRenderer.RenderToString(
|
|
moduleName: "ReactApp/components/ReactApp.jsx",
|
|
exportName: "ReactApp",
|
|
baseUrl: Request.Path
|
|
);
|
|
return View();
|
|
}
|
|
|
|
public IActionResult Error()
|
|
{
|
|
return View("~/Views/Shared/Error.cshtml");
|
|
}
|
|
}
|
|
}
|