DRYな備忘録

Don't Repeat Yourself.

(訳しながら)つくって覚えるRevelフレームワーク - その1

Revelとは

The Revel Web Framework for Go

Golangのウェブフレームワークです。Router,Controllerを提供していて、他にも最低限のアプリケーションテストが最初から準備されている感じのもの。

すでに

いくつかの自分のサービスはRevelで運用している

otiai10/log-kcwidget · GitHub

とはいえ

全然理解できてないので、このたび、ちゃんとドキュメントを一字一句逃さず読みつつ、つくりながら知っていきたいと思った。プログラミングと英語の勉強同時に出来てすごい(小並感

Revelの紹介

早速、Revelの紹介から見ていきます

The Revel Web Framework for Go

"Features"

  • Hot Code Reload
    • Edit, save, and refresh. Revel compiles your code and templates for you, so you don't miss a beat. Code doesn't compile? It gives you a helpful description. Run-time code panic? Revel has you covered.

    • 編集や保存、更新をすれば、Revelがコードやテンプレをコンパイルしてくれるので、コンパイル忘れすることはありません。コンパイル失敗したときは、良い感じのコンパイルエラーで説明してくれるはずです。ランタイムのpanicが出たときもサポートしてくれるでしょう。

  • Comprehensive
    • Revel provides routing, parameter parsing, validation, session/flash, templating, caching, job running, a testing framework, and even internationalization.

    • ルーティング、パラメータ取得、バリデーション、セッション/フラッシュデータ、テンプレーティング、キャッシュ、ジョブ、テストフレームワークを提供します。なんと、国際化もサポートできます。

  • High Performance
    • Revel builds on top of the Go HTTP server, which was recently benchmarked to serve three to ten times as many requests as Rails across a variety of loads.

    • RevelはGoHTTPサーバを基につくられています。最近のベンチマークによると、様々な負荷状況において、Railsの実に3〜10倍のリクエストを捌けます。

"Framework Design"

  • Synchronous
    • The Go HTTP server runs each request in its own goroutine. Write simple callback-free code without guilt.

    • GoHTTPサーバは、リクエストを独自のgoroutineで捌きます。シンプルでコールバックの無いコードを気兼ねなく書けます。

  • Stateless
    • Revel provides primitives that keep the web tier stateless for predictable scaling. For example, session data is stored in the user cookie, and the cache is backed by a memcached cluster.

    • Revelは、通信の物理階層をステートレスに保つミニマムな構成を提供するので、安全にスケールすることができます。たとえばセッションのデータはクッキーに保存され、キャッシュはmemcachedクラスタに保存されます。

  • Modular
    • Revel is built around composable middleware called filters, which implement nearly all request-processing functionality. Developers have the freedom to replace the default filters with custom implementations (e.g. a custom router).

    • Revelは"filters"と呼ばれる再構成可能なミドルウェア上で動きます。"filters"はデフォルトでほぼすべてのリクエスト処理の関数を備えていますが、いつでも独自に実装されたカスタムfilter(例: a custome router)で置き換えることが可能です。

次回は

同じページのOverviewを訳す