引入后端API项目并重构前后端桥接与路由

本次提交新增了 Avalonia-API(Web API)与 Avalonia-Services(业务服务)两个项目,完善了解决方案结构。重构了 Avalonia-PC 前端与后端的桥接逻辑,实现了基于前缀的路由分发、静态服务、开发者工具等功能。同步更新了 .gitignore、api.js 及相关配置文件,为后续业务扩展和维护打下基础。
This commit is contained in:
2026-04-23 17:25:31 +08:00
parent 9b90a471c2
commit 506ab4857a
16 changed files with 455 additions and 26 deletions
@@ -0,0 +1,20 @@
using Avalonia_Services.Models;
using Avalonia_Services.Services;
using Microsoft.AspNetCore.Mvc;
namespace Avalonia_API.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController(WeatherForecastService weatherForecastService) : ControllerBase
{
private readonly WeatherForecastService _weatherForecastService = weatherForecastService;
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return _weatherForecastService.GetWeatherForecasts();
}
}
}