> For the complete documentation index, see [llms.txt](https://monksoul.gitbook.io/hoa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://monksoul.gitbook.io/hoa/rumenzhinan.md).

# 五、入门指南

## 第一步

在 `Hoa.Application` 项目层中添加 `Test` 文件夹，接着新增 `ITestAppService` 接口文件和 `TestAppService` 实现类文件，并输入下面代码：

### ITestAppService 代码

```csharp
using System.ComponentModel.DataAnnotations;

namespace Hoa.Application.Test
{
    public interface ITestAppService
    {
        /// <summary>
        /// 获取名称
        /// </summary>
        /// <param name="name">名称</param>
        /// <returns></returns>
        string GetName([Required]string name);
    }
}
```

### TestAppService 代码

```csharp
using Hoa.Dependencies;
using Hoa.ServiceController.Attributes;
using System.ComponentModel.DataAnnotations;

namespace Hoa.Application.Test
{
    [HoaServiceController]
    public class TestAppService : ITestAppService, IAppServiceDependency
    {
        /// <summary>
        /// 获取名称
        /// </summary>
        /// <param name="name">名称</param>
        /// <returns></returns>
        public string GetName([Required] string name)
        {
            return $"Hello! Hoa {name}";
        }
    }
}
```

## 第二步

### 设置启动项目

设置 Hoa.Web.Host 项目层未框架启动项目（**右键-> 设为框架启动项目**）

### 启动并允许项目

通过快捷键 `F5` 即可启动浏览器查看，如下图所示：

![](/files/-M7l1tuwVm_dGCvMqUnv)

## 第三步

### 测试接口

找到 `/api/Test/GetName` 条目并点击展开，之哈点击右上角的 **Try it out** 试试吧！

很神奇吧！:heart\_eyes: 就这么简单就可以生成 RESTFul 风格的 API文档了。
