跳到导航

HTTP JSON 端点

以 Markdown 格式查看

端点在 Fern 中定义在 endpoints 键下。以下是定义单个 REST 端点的示例:

users.yml
service:
base-path: /users
auth: false
endpoints:
createUser:
path: /create
method: POST
request:
body:
properties:
userName: string

示例

您可以通过使用 examples 键来提供请求和响应的示例。

service:
base-path: /users
auth: false
endpoints:
getUser:
path: /{userId}
path-parameters:
userId: string
method: GET
response: User
examples:
- path-parameters:
userId: alice-user-id
response:
body:
userId: alice-user-id
name: Alice