LoginSignup
3
5

More than 5 years have passed since last update.

Dart x Bridge で、Webサービス を作成してみよう。

Last updated at Posted at 2015-12-24

Bridge というイケてる子がリリースされたらしい。

https://github.com/dart-bridge/framework
http://dart-bridge.io/
https://medium.com/@emilniklas

Bridge は Ruby and Rails、Django のようなもの

  • Server side framework
  • Host SPAs and REST APIs
  • Deliver classic websites
  • Host command line application
  • Decoupled Service Architecture
  • Reflection Based Dependency Injection
  • Realtime CLI engine
  • Build-in libraries

Ruby and Rails , Django 的なものを、Dartで提供します。

また、Dartを使うので、クライアントサイド、サーバーサイドも
全て同じ言語で書くことができますね。Dartは便利ですね。

始めよう

https://www.youtube.com/watch?v=92IXvGN6tdo
Youtubeの動画の中で、その場でチャットアプリ作っています。

これを、訳そうかとも思ったのですが、今回はHello Worldだけ。
http://dart-bridge.io/docs/hello-world
を試してみた。

$ pub global activate new_bridge
$ new_bridge demo_chat
$ cd demo_chat/
$ dart bridge
=start
=watch

http://localhost:1337にアクセスすると、
スクリーンショット 2015-12-24 21.56.33.png

というページが表示されます。

#別Window
$ emacs ./lib/main/main.dart
library main;

import 'package:bridge/bridge.dart';
import '../app.dart';
part 'pages_controller.dart';

class Main {
  SkyIsTheLimit skyIsTheLimit;
  PagesController controller;

  Main(this.controller, this.skyIsTheLimit);

  routes(Router router) {
    router.get('/', (){return "Hello";});
  }

  tether(Tether tether) {
  }
}

とすると、以下のように表示されます。
スクリーンショット 2015-12-24 22.25.18.png

※ watchを指定していると、変更が自動で反映されます。

感想

申し訳ありません。
本文は、「Hello World」を試しただけでした。
公式の"Hello World"を読むのと大差ないですね。

もう少しこった事をして、せめて、「チャットアプリをさらっと作るみたいな事」をしたかったのですが、Advent Calender の期限に間に合わないので、諦めました。

ごめんなさい。

まぁ、Dartから離れてしまった人とかに、こんな動きがあったのかー。
的なのを感じでもらえれば良いかな。



Kyorohiro Work
http://kyorohiro.strikingly.com/

3
5
1

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
3
5