Skip to content

Instantly share code, notes, and snippets.

@lagenorhynque
Last active November 11, 2022 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lagenorhynque/ff1482e295c68c57f5db022fb54473b2 to your computer and use it in GitHub Desktop.
Save lagenorhynque/ff1482e295c68c57f5db022fb54473b2 to your computer and use it in GitHub Desktop.
Ductモジュール入門: Clojureフレームワーク"Duct"の拡張方法を理解しよう

Ductモジュール入門

Clojureフレームワーク"Duct"の拡張方法を理解しよう

(defprofile lagénorhynque
  :id           @lagenorhynque
  :reading      "/laʒenɔʁɛ̃k/"
  :aliases      ["カマイルカ🐬"]

  :languages    [Clojure Haskell English français]

  :interests    [programming language-learning law mathematics]

  :commits      ["github.com/lagenorhynque/duct.module.pedestal"
                 "github.com/lagenorhynque/duct.module.cambium"]
  :contributes  ["github.com/japan-clojurians/clojure-site-ja"])

twitter icon


  1. Integrantの基本

  2. Ductの基本

  3. Ductモジュールの作り方


Integrantの基本


Integrantとは

依存関係に従ってライフサイクル管理を行う仕組み

cf. Component, mount, Clip


ライフサイクルフックとしてのマルチメソッド


Ductの基本


Ductとは

Integrantに対する便利な拡張


Leiningenテンプレート duct

# API関連、ルーティングライブラリAtaraxy、サンプルコード付き
$ lein new duct <project name> +api +ataraxy +example

コア機能 duct/core


標準モジュール


Ductモジュールの作り方


実装方法

ClojureサーバサイドフレームワークDuctガイド > Ductの「モジュール」とは


  • API/サービス開発ライブラリPedestalを組み込むモジュール

  • 標準モジュールduct/module.webの代替


  • JSON形式でのログ出力を可能にするライブラリCambiumを組み込むモジュール

  • 標準モジュールduct/module.loggingの代替


Further Reading

#!/usr/bin/env bash
# npm install -g reveal-md
reveal-md duct-module-getting-started.md --theme night --highlight-theme monokai-sublime -w $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment