问题描述
我使用 Strapi CMS 来处理 NoSQL 数据库的数据。 因此,当我在 Strapi CMS 上发布博客时,我想要做的是在 Medium 上发布该博客。
我拥有使用 API 在媒体上发布它的所有凭据。
所以,问题是如何实现这一点,如何在创建或更新帖子时在 Strapi CMS 中执行特定操作,以便我可以获取数据并发送到 {{3 }} 通过 POST 请求。
解决方法
所以经过 Ghosh 的一些研究和指导后,我开始了解 Strapi 默认提供的 webhooks。
这些钩子有点像 React Lifecycle Hooks
关于钩子的更多信息:Here
所以对于我的情况,我必须添加一个钩子,在创建博客文章后触发一些操作。
因此,在 $table->id();
$table->bigInteger('community_id')->unsigned();
$table->bigInteger('competition_id')->unsigned();
$table->integer('point')->nullable();
$table->timestamps();
$table->foreign('community_id')->references('id')->on('communities');
$table->foreign('competition_id')->references('id')->on('competitions');
中,我添加了此代码
api/blog/models/{blog}.js