LoginSignup
1

More than 5 years have passed since last update.

Golangのrevelをインストールしてみる

Last updated at Posted at 2016-06-30

revelフレームワークのインストール

参考)https://revel.github.io/tutorial/gettingstarted.html

Git,HGがインストールされていたからか、これだけです
$ go get github.com/revel/revel

コマンドラインツールのインストール

こちらも簡単です。
$ go get github.com/revel/cmd/revel

~/.bashrc
export PATH="$PATH:$GOPATH/bin"

ヘルプを見ることで何ができるようになったか、なんとなくわかりますね

$ revel help
~
~ revel! http://revel.github.io
~
usage: revel command [arguments]

The commands are:

    new         create a skeleton Revel application
    run         run a Revel application
    build       build a Revel application (e.g. for deployment)
    package     package a Revel application (e.g. for deployment)
    clean       clean a Revel application's temp files
    test        run all tests from the command-line
    version     displays the Revel Framework and Go version

Use "revel help [command]" for more information.

revelで画面を表示してみる

コマンドでプロジェクトを作成する

これでrevelを利用するために必要な雛形ができあがります
$ revel new revelSample

出来上がったディレクトリを見てみましょう

$ find . -type d
./app
./app/controllers
./app/views
./app/views/App
./app/views/errors
./conf
./messages
./public
./public/css
./public/fonts
./public/img
./public/js
./tests

だいたいイメージがつきますね

作成したプロジェクトを起動してみる

$ revel run revelSample

はい。これでOKです。

ブラウザで確認してみる

サーバーを起動した状態で以下にアクセスする
http://localhost:9000/
「It works!」とブラウザで表示されれば完了です

非常に簡単ですね。

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