File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # ViteDevProxy
2+
3+ A .NET library that provides easy integration of Vite development server proxying in ASP.NET Core applications using YARP (Yet Another Reverse Proxy).
4+
5+ ## Installation
6+
7+ ``` bash
8+ dotnet add package ViteDevProxy
9+ ```
10+
11+ ## Usage
12+
13+ ### Basic Setup
14+
15+ Add ViteDevProxy to your ASP.NET Core application:
16+
17+ ``` csharp
18+ using ViteDevProxy ;
19+
20+ var builder = WebApplication .CreateBuilder (args );
21+
22+ // Add ViteDevProxy services (defaults to http://localhost:5173/)
23+ builder .Services .AddViteDevProxy ();
24+
25+ var app = builder .Build ();
26+
27+ // Map the reverse proxy
28+ app .MapViteDevProxy ();
29+
30+ app .Run ();
31+ ```
32+
33+ ### Custom Vite Dev Server URL
34+
35+ ``` csharp
36+ // Configure custom Vite dev server URL
37+ builder .Services .AddViteDevProxy (" http://localhost:3000/" );
38+ ```
39+
40+ ## What it does
41+
42+ ViteDevProxy automatically configures YARP to:
43+ - Proxy all requests (` {**catch-all} ` ) to your Vite development server
44+ - Handle WebSocket connections for Hot Module Replacement (HMR)
45+ - Maintain proper headers and request context
46+
47+ ## Development Workflow
48+
49+ 1 . Start your Vite development server:
50+ ``` bash
51+ npm run dev
52+ ```
53+
54+ 2 . Start your ASP.NET Core application with ViteDevProxy configured
55+
56+ 3 . Access your application through the ASP.NET Core server - all frontend requests will be automatically proxied to Vite
57+
58+ ## Requirements
59+
60+ - .NET 9.0
61+ - Vite development server running (typically on port 5173)
62+
63+ ## License
64+
65+ MIT
You can’t perform that action at this time.
0 commit comments