2024-08-20 14:20:27 +02:00
2022-11-11 11:54:31 +01:00
2024-08-20 14:20:27 +02:00
hi
2022-11-10 17:02:40 +01:00
hi
2022-11-10 17:02:40 +01:00
hi
2022-11-10 17:02:40 +01:00
2022-11-11 12:07:59 +01:00
hi
2022-11-10 17:02:40 +01:00

ViteProxy

Introduction

ViteProxy is a proxy for vite projects within ASP.NET Core.

This project is meant to be used within server-side applications and not within SPAs (single-page applications).
Without ViteProxy you would have to start your server application (e.g. dotnet run) and additionally the vite dev server (e.g. npm run dev). The proxy is registered as a hosted service and started in tandem with the server application.

Usage

1. Register service

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddViteProxy();

2. Deliver additional static files

var app = builder.Build();

app.UseStaticFiles();
app.UseViteStaticFiles();

3. Configure vite.config

export default {
  ...,
  server: {
    port: process.env.PORT || 2341,
    cors: true
  },
  ...
};

License

MIT License

S
Description
Proxy for vite projects within ASP.NET Core
Readme 71 KiB
Languages
C# 100%