快速入门
警告
需要搭建一个 API ?
请确保已经安装 JDK 17, Maven, 和 Docker Engine 🤗
- 我们提供如何安装 JDK 17 和 Maven 的教程
- 我们也提供安装 Docker Engine 的链接
将仓库模版实例化
请访问Astraios GitHub,然后执行以下操作之一:
- 使用
git clone https://github.com/paion-data/astraios.git
克隆代码仓库,或者 - 用我们自己的 Web 服务名称执行以下操作来将模版实例化:
创建数据模型
Astraios 模型是一个 Web 服务项目中最重要的代码之一。此模型是我们希望公开的数据视图。 在这个例子中,我们将对 book 进行建模,因为大多数人对生活中的书比较熟悉。
我们的 Book 模型大致如下:
import com.paiondata.elide.annotation.Include;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
@Entity
@Table(name = "book")
@Include(rootLevel = true, name = "book", description = "book entity", friendlyName = "book")
public class Book {
@Id
@GeneratedValue
public long id;
public String title = "";
}