Skip to content

frederic2ec/inertia-aspnetcore

Repository files navigation

image

Inertia.js ASP.Net Core Adapter

Prerequisite

  1. .NET Core v5 and later
  2. An ASP.NET Core MVC project

Install

  1. Package Manager: PM> Install-Package Inertia.AspNetCore
  2. .NET CLI: dotnet add package Inertia.AspNetCore

Usage

  1. Setup Startup.cs
using Inertia.AspNetCore;

public void ConfigureServices(IServiceCollection services)
{
    services.AddControllersWithViews().AddInertia();
}
  1. In your controller
using Inertia.AspNetCore;

public class HomeController : InertiaController {
    public IActionResult Index()
    {
       return Inertia("Index", new
       {
           UserId = 1
       });
    }
}

Visit inertiajs.com to learn more.