serve
Cosense の REST API をローカルにプロキシするサーバを起動します。
書式
cos serve --rest [--port <n>] [--host <addr>] [--token <secret>] [--allow-write] --project <name>
フラグ
--rest — REST プロキシモードで起動、必須
--port <n> — 待受ポート (デフォルト: 8080)
--host <addr> — 待受アドレス (デフォルト: 127.0.0.1)
--token <secret> — Bearer トークン認証を有効化 (非ループバック時必須)
--allow-write — 書き込み系エンドポイントを有効化
使用例
code:bash
# 読み取り専用サーバーを起動
cos serve --rest --port 8080 --project myproject
# 書き込みも許可
cos serve --rest --port 8080 --allow-write --project myproject
# Bearer トークンで保護 (ループバック外から公開する場合)
cos serve --rest --port 8080 --token mysecret --project myproject
# JSON 形式で起動情報を確認
cos serve --rest --port 8080 --project myproject --json
終了
SIGINT / SIGTERM でグレースフルシャットダウン。
関連ページ