Git Product home page Git Product logo

qiitan-api's Introduction

qiitan-api

Qiitaのコピーアプリ「Qiitan」のAPI。

概要

記事情報関連のAPIが利用できる。 定期的にキャッシュを保管して、API呼び出し時にキャッシュを返すように。キャッシュ保管のためにAerospikeを使用。

環境構築

まず、以下の前提条件が満たされていることを確認すること。

  • プラットフォームに合わせたDockerがインストール済み
  • docker-compose がインストール済み

その後、以下のように実行。

$ git clone [email protected]:Matsushin/qiitan-api.git
$ cd qiitan-api

$ docker-compose build

データベース

本リポジトリでは、「Qiitan」リポジトリで作成されるDBを利用している。 APIで結果を返すには事前にデータベースの作成とデータ投入が必要になります。

アプリケーション起動

以下のように実行。

$ docker-compose up

その後、 docker ps コマンドを実行し、api/mysql/nginx/aerospikeコンテナが起動していることを確認する。

APIへのアクセスは以下のように行う。

$ curl localhost:18080

各API

$ curl localhost:18080/pvt/health # ヘルスチェック
$ curl localhost:18080/v1/articles # 記事一覧
$ curl localhost:18080/v1/ranking/like # いいね記事ランキング
$ curl localhost:18080/v1/ranking/stock # ストック記事ランキング

APIのライブリロードについて

Go APIはfreshを使ってライブリロードするようになっている。
また、ホストの qiitan-api ディレクトリはコンテナにマウントされているため、
ホスト側でGoのコードを編集すると即APIの動作に反映される。

MySQLコンテナへのログイン

MySQLコンテナにログインしたい場合は以下のように実行する。

$ docker exec -it qiitan-api_mysql_1 bash
# mysql -uroot qiitan # パスワードなし

その他

  • ECSへのデプロイ(deploy.sh)は、go-ecs-ecr を使用してCircleCIから実行する。

qiitan-api's People

Contributors

matsushin avatar

Watchers

 avatar James Cloos avatar

qiitan-api's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.