hasura_使用Hasura构建GraphQL应用

hasura

Today in this article we are going to build a secure todo list using GraphQL API with Hasura. First you have to know about Hasura. It is nothing but a postgreSQL database that automatically gives you a real-time data.

今天,在本文中,我们将使用带有Hasura的GraphQL API构建安全的待办事项列表。 首先,您必须了解Hasura。 它只是一个可以自动为您提供实时数据的postgreSQL数据库。

Before getting into the topic first let see about steps to be followed for creating this app.

首先进入主题,先了解创建此应用程序要遵循的步骤。

  • Build backend.

    建立后端。
  • Create a data tables.

    创建一个数据表。
  • Authentication.

    身份验证。
  • Authorization.

    授权。
  • Build frontend.

    建立前端。
  • Deployment.

    部署。

Now let’s get deep into the topic.

现在让我们深入探讨该主题。

建立后端 (Build backend)

Go to Hasura and create an new account. Hasura will ask to connect your database. Choose “Try a free database with heroku”.

转到Hasura并创建一个新帐户。 Hasura将要求连接您的数据库。 选择“ 使用heroku尝试免费数据库 ”。

Image for post
Heroku website
Heroku网站

After finishing the setup with heroku new instance is created and it is running at the url like this.

用heroku完成设置后,将创建一个新实例,它在url这样运行。

https://<YOUR_HEROKU_PROJECT>.herokuapp.com

https:// <YOUR_HEROKU_PROJECT> .herokuapp.com

And then navigate to project and click launch console to open Hasura dashboard.

然后导航到项目并单击启动控制台以打开Hasura仪表板。

Image for post
Project layout
项目布局

创建数据表 (Create data tables)

Navigate to data and create a new table with name todos with columns like this,

导航到数据并创建一个名称为todos的新表,其中包含如下所示的列,

  • id : Integer

    id :整数

  • title : Text

    标题 :文字

  • is_completed : Boolean

    is_completed :布尔值

  • user_id : Text

    user_id :文本

  • created_at : Timestamp

    created_at :时间戳

Set the id column as unique and primary key.

id列设置为唯一键和主键。

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值