Prototype of Aozora-bunko package management server prototype
青空文庫の作品の情報を配布するためのAPIサーバのプロトタイプです。CoffeeScriptで記述していた PubserverをES2017で実装しなおしています。
- Node.js
- MongoDB (データ格納用)
- Redis (取得データのキャッシュ用)
$ npm install
$ npm startAOZORA_MONGODB_CREDENTIALMongoDBにアクセスするユーザ名・パスワード "username:password@" (default: "")AOZORA_MONGODB_HOSTMongoDBのホスト名 (default: "localhost")AOZORA_MONGODB_PORTMongoDBのポート番号 (default: 27017)PORTpubserverの待ち受けポート番号 (default: 5000)
以下は heroku.com で仮稼働しているプロトタイプサーバのURLです。 ローカルで動かす時にはホスト名を "localhost:5000"で適宜読み替えてください。
curl http://pubserver2.herokuapp.com/api/v0.1/books
追加パラメータ
title: タイトル名でのフィルタauthor: 著者名でのフィルタfields: 取得する属性を指定limit: 取得するアイテム数を制限skip: 指定した分のアイテムをスキップしてそれ以降を取得after: release_dateがこの日付よりも新しいモノのみを返す(YYYY-MM-DD)
curl http://pubserver2.herokuapp.com/api/v0.1/books/{book_id}
curl http://pubserver2.herokuapp.com/api/v0.1/books/{book_id}/card
curl http://pubserver2.herokuapp.com/api/v0.1/books/{book_id}/content?format=txt
curl http://pubserver2.herokuapp.com/api/v0.1/books/{book_id}/content?format=html
curl http://pubserver2.herokuapp.com/api/v0.1/persons
追加パラメータ
name: 著者名・訳者名でのフィルタ
curl http://pubserver2.herokuapp.com/api/v0.1/persons/{person_id}
curl http://pubserver2.herokuapp.com/api/v0.1/workers
追加パラメータ
name: 工作員名でのフィルタ
curl http://pubserver2.herokuapp.com/api/v0.1/workers/{worker_id}
curl http://pubserver2.herokuapp.com/api/v0.1/ranking/{type}/{year}/{month}
パラメータ
type: xhtml か txt のどちらかを指定year: 集計年(西暦)。2009年からのデータが残っている様です。month: 集計月 (01~12)
こちらを参照下さい