Coder Social home page Coder Social logo

rin's Introduction

Rin

Request/response Inspector middleware for ASP.NET Core. like Glimpse.

Build-Release Build-Development NuGet version

Rin captures HTTP requests to ASP.NET Core app and provides viewer for captured data. It's useful tool to debug your Web application (e.g. Web sites, API apps).

โœ… Features

Capture requests and responses

Rin captures HTTP traffics between the ASP.NET Core app and any clients.

  • Headers + Body
  • Traces (Microsoft.Extensions.Logging.ILogger, log4net, ...)
  • Unhandled Exception

Inspect from Web browser in realtime

View events timeline

Rin inspector displays events that occurred while processing a request.

Preview a request/response body

Rin inspector can display request and response body with a preview. (e.g. JSON, Image, HTML, JavaScript ...)

View related trace logs

Rin captures a request and response. Also, it captures logs while processing a request.

  • Built-in Microsoft.Extensions.Logging.ILogger integration
  • log4net Appender

Save and export request/response

You can replay a request easily using cURL and LINQPad.

  • Save request/response body
  • Copy request as cURL and C#

Integrate with ASP.NET Core MVC

  • Record timings of view rendering and action execution
  • In-View Inspector (like MiniProfiler)

๐Ÿ“ Requirements

  • .NET Core 3.1+
  • ASP.NET Core 3.1+
  • Modern browser (e.g. Microsoft Edge, Google Chrome, Firefox, Safari...)
    • WebSocket connectivity

โšก QuickStart

Install NuGet Package

Using Visual Studio

Dependencies -> Manage NuGet Packages... -> Search and install Rin and Rin.Mvc (if your project is built with ASP.NET Core MVC) package.

Using dotnet command

dotnet add package Rin
dotnet add package Rin.Mvc

Using Package Manager

Install-Package Rin
Install-Package Rin.Mvc

Setup and configure Rin

Program.cs

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .ConfigureLogging(configure =>
        {
            // Add: Enable Rin Logger
            configure.AddRinLogger();
        })
        .UseStartup<Startup>();

Startup.cs

public class Startup
{
    ...
    public void ConfigureServices(IServiceCollection services)
    {
        ...
        services.AddControllersWithViews()
            // Add(option): Enable ASP.NET Core MVC support if the project built with ASP.NET Core MVC
            .AddRinMvcSupport();        

        // Add: Register Rin services
        services.AddRin();
    }
    ...
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            // Add: Enable request/response recording and serve a inspector frontend.
            // Important: `UseRin` (Middlewares) must be top of the HTTP pipeline.
            app.UseRin();

            // Add(option): Enable ASP.NET Core MVC support if the project built with ASP.NET Core MVC
            app.UseRinMvcSupport();

            app.UseDeveloperExceptionPage();

            // Add: Enable Exception recorder. this handler must be after `UseDeveloperExceptionPage`.
            app.UseRinDiagnosticsHandler();
        }
        ...
    }
}

_Layout.cshtml (for ASP.NET Core MVC)

@inject Rin.Mvc.View.RinHelperService RinHelper
...
    <environment include="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/site.css" />
        @* Add: Enable In-View Inspector for ASP.NET Core MVC *@
        @RinHelper.RenderInViewInspector()
    </environment>
...

Start the application and open Inspector on the web

Launch the app, then open http://[Host:Port]/rin/ in the browser, you can see Rin Inspector now.

๐Ÿ”จ Develop and build Rin Inspector (client side)

Rin Inspector (client side) codes is separated from Rin core C# project. If you want to develop Rin (C#) or launch a sample project, you need to build and deploy the artifacts.

[Rin.Frontend, Rin.Mvc.Frontend] Setup and start the development server

  • yarn
  • yarn start

[Rin.Frontend] Build Rin/Resources.zip

  • yarn build
  • yarn pack

[Rin.Mvc.Frontend] Build Rin.Mvc/EmbeddedResources

  • yarn build
  • copy .\dist\static\main.js* ..\Rin.Mvc\EmbeddedResources\

License

MIT License

rin's People

Contributors

mayuki avatar azyobuzin avatar kotx avatar vip32 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.