0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

NestJSで外部API連携を管理するシンプルな方法

0
Posted at

NestJSで外部API連携を管理するシンプルな方法

NestJSで複数の外部サービスと連携する場合、Providerごとに処理を分離すると管理しやすくなります。

interface PublishProvider {
  publish(content: string): Promise<void>;
}

Facebook、Qiita、DiscordなどのProviderが同じInterfaceを実装することで、Publisher側のコードを共通化できます。

さらに、OAuth Token、Rate Limit、Retry処理を共通Serviceに分離しておくと、新しいPlatform追加時の変更も最小限にできます。

実際のWeb開発・Automation関連の情報はこちら:

#NestJS #TypeScript #API #OAuth #Automation

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?