Skip to content

Commit 5b5ef6f

Browse files
committed
Add README.md with installation, usage, and development workflow instructions for ViteDevProxy
1 parent a0910a7 commit 5b5ef6f

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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

0 commit comments

Comments
 (0)