{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/pub/issues/791","labels_url":"https://api.github.com/repos/dart-lang/pub/issues/791/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/pub/issues/791/comments","events_url":"https://api.github.com/repos/dart-lang/pub/issues/791/events","html_url":"https://github.com/dart-lang/pub/issues/791","id":85644744,"number":791,"title":"prepare a Dart app for server-side deployment","user":{"login":"DartBot","id":8958862,"avatar_url":"https://avatars.githubusercontent.com/u/8958862?v=3","gravatar_id":"","url":"https://api.github.com/users/DartBot","html_url":"https://github.com/DartBot","followers_url":"https://api.github.com/users/DartBot/followers","following_url":"https://api.github.com/users/DartBot/following{/other_user}","gists_url":"https://api.github.com/users/DartBot/gists{/gist_id}","starred_url":"https://api.github.com/users/DartBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartBot/subscriptions","organizations_url":"https://api.github.com/users/DartBot/orgs","repos_url":"https://api.github.com/users/DartBot/repos","events_url":"https://api.github.com/users/DartBot/events{/privacy}","received_events_url":"https://api.github.com/users/DartBot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/pub/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/dart-lang/pub/labels/Fixed","name":"Fixed","color":"ededed"},{"url":"https://api.github.com/repos/dart-lang/pub/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/dart-lang/pub/labels/Pub-Build","name":"Pub-Build","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-06-05T22:14:50Z","updated_at":"2015-06-05T22:14:51Z","closed_at":null,"body":"<a href=\"https://github.com/sethladd\"><img src=\"https://avatars.githubusercontent.com/u/5479?v=3\" align=\"left\" width=\"96\" height=\"96\"hspace=\"10\"></img></a> **Issue by [sethladd](https://github.com/sethladd)**\n_Originally opened as dart-lang/sdk#15731_\n\n----\n\nRight now, `pub build` is optimized for web apps. Dart server-side is growing up, and we need a way to build a Dart app for server deployment.\n\nWe think this means create a snapshot of the app.\n\nWe think this also means we need `pub build` to support a package with both web/ entry points and bin/ entry points. Often, the server will live in bin/ and it will serve up resources from web/"},"comment":{"url":"https://api.github.com/repos/dart-lang/pub/issues/comments/109457846","html_url":"https://github.com/dart-lang/pub/issues/791#issuecomment-109457846","issue_url":"https://api.github.com/repos/dart-lang/pub/issues/791","id":109457846,"user":{"login":"DartBot","id":8958862,"avatar_url":"https://avatars.githubusercontent.com/u/8958862?v=3","gravatar_id":"","url":"https://api.github.com/users/DartBot","html_url":"https://github.com/DartBot","followers_url":"https://api.github.com/users/DartBot/followers","following_url":"https://api.github.com/users/DartBot/following{/other_user}","gists_url":"https://api.github.com/users/DartBot/gists{/gist_id}","starred_url":"https://api.github.com/users/DartBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartBot/subscriptions","organizations_url":"https://api.github.com/users/DartBot/orgs","repos_url":"https://api.github.com/users/DartBot/repos","events_url":"https://api.github.com/users/DartBot/events{/privacy}","received_events_url":"https://api.github.com/users/DartBot/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T22:14:51Z","updated_at":"2015-06-05T22:14:51Z","body":"<a href=\"https://github.com/sgjesse\"><img src=\"https://avatars.githubusercontent.com/u/1343914?v=3\" align=\"left\" width=\"48\" height=\"48\"hspace=\"10\"></img></a> **Comment by [sgjesse](https://github.com/sgjesse)**\n\n----\n\nI think the important part of adding some kind of server deployment is that it should be easy to get started. We define the supported directory structure, and generate a directory structure which can be copied to the Dart server (and maybe also to a frontend server serving the static content when the Dart server is accessed through a reverse proxy).\n\nThe generated directory structure we should keep it as close to the directory structure the developer see in the editor to limit confusion.\n\nBasically having the following code in the bin/ entrypoint (main.dart):\n\nimport 'dart:io';\nimport 'package:http_server/http_server.dart' as http_server;\nimport 'package:route/server.dart' show Router;\n\nmain() {\n&nbsp;&nbsp;HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, port).then((server) {\n&nbsp;&nbsp;&nbsp;&nbsp;var router = new Router(server);\n&nbsp;&nbsp;&nbsp;&nbsp;var virDir = new http_server.VirtualDirectory('web');\n&nbsp;&nbsp;&nbsp;&nbsp;virDir.serve(router.defaultStream);\n&nbsp;&nbsp;});\n}\n\nYou then run the pub command, copy the generated directory structure to the server and run\n\n&nbsp;&nbsp;$ dart main.snapshot \n\nWe should make writing this 10-line boilerplate server app using the http-server package with client side Dart just work. I don't envision that we will support all kind of configuration options. When a project reaches a certain size one most likely need to have a custom deployment system anyway.\n"}}