feat: setup spa proxy when develop backend server

This commit is contained in:
SikongJueluo 2025-05-12 21:08:08 +08:00
parent 257d63e63d
commit 9eb3acb94c
No known key found for this signature in database
4 changed files with 6 additions and 5 deletions

View File

@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"dev": "vite --host",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",

View File

@ -106,11 +106,9 @@ try
app.UseCors();
app.UseAuthorization();
// if (app.Environment.IsDevelopment())
// {
// Swagger
app.UseOpenApi();
app.UseSwaggerUi();
// }
// Router
app.MapControllers();

View File

@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="PublishAllRids.xml" />
<!-- <Import Project="PublishSPA.xml" /> -->
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>

View File

@ -39,5 +39,9 @@ export default defineConfig({
build: {
outDir: 'wwwroot',
emptyOutDir: true, // also necessary
},
server: {
proxy: {},
port: 5173,
}
})