LoginSignup
1
1

More than 5 years have passed since last update.

Phoenix アプリケーションを作成する

Posted at

Mac で Phoenix アプリケーションを作成してみます。

環境

  • Mac OSX 10.10.3
  • elixir 1.0.5
  • node 0.12.7
  • npm 2.12.1

Phoenix はコンパイル時に node と npm を使います。これらのバージョンが古いとうまくいかないことがありますので、忘れずにバージョンを上げておきましょう。

Phoenix のインストール

インストールはとても簡単で、公式サイトの Installation にある通り、以下のコマンドを実行するだけです。

$ mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v0.17.0/phoenix_new-0.17.0.ez

version 表記は適宜最新のものに書きかえてください。

Phoenix アプリケーションの作成

以下のコマンドでアプリケーション sample_app を作成します。

$ mix phoenix.new sample_app

途中、依存関係インストールに関する問いかけがありますが、Y もしくは Enter で応えておきます。

とりあえず動かす

作成が終わったらすぐに動かせます。

生成されたディレクトリに移動し、サーバを立ち上げてみましょう。

$ cd sample app
$ mix phoenix.server

コンパイルに少し時間がかかるかもしれませんが、以下のように表示されたら完了です

...
Compiled lib/sample_app/endpoint.ex
Generated sample_app app
[info] Running SampleApp.Endpoint with Cowboy on http://localhost:4000
25 Aug 01:50:23 - info: compiled 5 files into 2 files, copied 3 in 5770ms

さっそくブラウザで確認してみます。

スクリーンショット 2015-08-25 1.51.07.png

無事に立ち上がりました。

DB の設定やらなにやらも簡単にできるようなのですが、今回はとりあえずここまでの動作確認とします。

1
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
1
1