{"id":548,"date":"2019-04-24T16:49:41","date_gmt":"2019-04-24T07:49:41","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2019\/04\/24\/google_app_engine_java_spring_bootvuetify_gae\/"},"modified":"2019-04-24T16:49:41","modified_gmt":"2019-04-24T07:49:41","slug":"google_app_engine_java_spring_bootvuetify_gae","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/24\/google_app_engine_java_spring_bootvuetify_gae\/","title":{"rendered":"Google App Engine Java \u30b9\u30bf\u30f3\u30c0\u30fc\u30c9+Spring Boot+Vuetify \u958b\u767a\u74b0\u5883\u3068\u672c\u756a\u74b0\u5883\u306e\u8a2d\u5b9a\u304b\u3089GAE\u3078\u30c7\u30d7\u30ed\u30a4"},"content":{"rendered":"<p><a href=\"https:\/\/www.amazon.co.jp\/%E5%9F%BA%E7%A4%8E%E3%81%8B%E3%82%89%E5%AD%A6%E3%81%B6-Vue-js-mio\/dp\/4863542453\/ref=as_li_ss_il?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&amp;keywords=Vue&amp;qid=1556092088&amp;s=gateway&amp;sr=8-2&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=095c24da8a1b76c1ba4be5a5bce78577\" target=\"_blank\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=4863542453&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" border=\"0\"><\/a><img loading=\"lazy\" decoding=\"async\" width=\"1\" height=\"1\" style=\"margin: 0px !important; border: currentcolor !important; border-image: none !important;\" alt=\"\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=li2&amp;o=9&amp;a=4863542453\" border=\"0\"><\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3082\u3063\u3066\u3044\u304d\u305f\u3044\u69cb\u6210\u306f\u3001\u4ee5\u4e0b\u3002<\/p>\n<p>Eclipse \u4e0a\u3067\u3001API\u306e\u958b\u767a\u3001Visual Studio Code\u4e0a\u3067\u3001UI\u306e\u958b\u767a\u3092\u305d\u308c\u305e\u308c\u884c\u3044\u3001UI \u306e\u30d3\u30eb\u30c9 -&gt; Eclipse\u5074\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u66f8\u304d\u51fa\u3057 -&gt; GAE\u3078\u30c7\u30d7\u30ed\u30a4\u3002<\/p>\n<p>\u30af\u30e9\u30a6\u30c9\u3092\u5229\u7528\u3057\u305fWeb\u30b5\u30fc\u30d3\u30b9\uff0bAPI+\u30e2\u30d0\u30a4\u30eb\u306e\u30a8\u30b3\u30b7\u30b9\u30c6\u30e0\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u74b0\u5883\u3092\u4f5c\u308a\u305f\u3044\u306e\u3060\u304c\u3001\u4e00\u3064\u4e00\u3064\u9762\u5012\u3060\u3002\u3042\u3068\u3001\u4e0b\u56f3\u306b\u3001Xamarin\u3092\u5165\u308c\u8fbc\u3093\u3067API\u547c\u3073\u51fa\u3057\u307e\u3067\u306e\u74b0\u5883\u3092\u4f5c\u308a\u305f\u3044\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/favphrase_architecture.png\"><img loading=\"lazy\" decoding=\"async\" width=\"637\" height=\"291\" title=\"favphrase_architecture\" style=\"display: inline; background-image: none;\" alt=\"favphrase_architecture\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/favphrase_architecture_thumb.png\" border=\"0\"><\/a><\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/20\/google_app_engine_java_spring_bootvuetifyajax\">\u30ed\u30fc\u30ab\u30eb\u958b\u767a\u74b0\u5883\u3067\u3001\u30b5\u30fc\u30d3\u30b9\u5074\u3068UI\u5074\u3092\u540c\u6642\u306b\u7acb\u3061\u4e0a\u3052\u3066\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3046\u3068\u3053\u308d\u307e\u3067\u78ba\u8a8d\u3067\u304d\u305f<\/a>\u306e\u3067\u3001Base URL \u3092\u958b\u767a\u74b0\u5883\u3068\u3001\u672c\u756a\u74b0\u5883\u3067\u5207\u308a\u66ff\u3048\u3089\u308c\u308b\u3088\u3046\u306b\u3057\u3001\u30c7\u30d7\u30ed\u30a4\u307e\u3067\u758e\u901a\u3059\u308b\u3002<\/p>\n<h2>1.Vue CLI\u3067\u306e\u74b0\u5883\u306e\u5207\u308a\u66ff\u3048<\/h2>\n<h3>1.1\u74b0\u5883\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb<\/h3>\n<p><a href=\"https:\/\/cli.vuejs.org\/guide\/mode-and-env.html\">h<\/a><a href=\"https:\/\/cli.vuejs.org\/guide\/mode-and-env.html#environment-variables\">https:\/\/cli.vuejs.org\/guide\/mode-and-env.html#environment-variables<\/a><\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u76f4\u4e0b\u306b\u3001.env \u30d5\u30a1\u30a4\u30eb\u3092\u914d\u7f6e\u3057\u3001\u305d\u3053\u306b\u8a2d\u5b9a\u3092\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n<pre><code>.env                # \u3059\u3079\u3066\u306e\u5834\u5408\u3067\u30ed\u30fc\u30c9\r\n.env.local          # \u3059\u3079\u3066\u306e\u5834\u5408\u3067\u30ed\u30fc\u30c9, Git\u3067\u306f\u7121\u8996\r\n.env.[mode]         # \u7279\u5b9a\u306e\u30e2\u30fc\u30c9\u306e\u5834\u5408\u306e\u307f\u30ed\u30fc\u30c9\r\n.env.[mode].local   # \u7279\u5b9a\u306e\u30e2\u30fc\u30c9\u306e\u5834\u5408\u306e\u307f\u30ed\u30fc\u30c9, Git\u3067\u306f\u7121\u8996<\/code><\/pre>\n<h3>1.2 \u30e2\u30fc\u30c9<\/h3>\n<p><a href=\"https:\/\/cli.vuejs.org\/guide\/mode-and-env.html#modes\">https:\/\/cli.vuejs.org\/guide\/mode-and-env.html#modes<\/a><\/p>\n<p>\u8a73\u7d30\u306f\u3001\u4e0a\u8a18URL\u53c2\u7167\u3002<\/p>\n<h3>1.3 \u8a2d\u5b9a\u5b9f\u88c5<\/h3>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/vue_env_path.png\"><img loading=\"lazy\" decoding=\"async\" width=\"193\" height=\"266\" title=\"vue_env_path\" style=\"display: inline; background-image: none;\" alt=\"vue_env_path\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/vue_env_path_thumb.png\" border=\"0\"><\/a><\/p>\n<h3>.env<\/h3>\n<p>\u672c\u756a\u74b0\u5883\u3067\u306f\u53d6\u5f97\u5143\u3068\u540c\u3058URL\u3068\u3059\u308b\u3002\u74b0\u5883\u5909\u6570\u540d\u306f\u3001VUE_APP_ \u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u3068\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3088\u3046\u3060\u3002<\/p>\n<pre class=\"prettyprint linenums\">VUE_APP_API_BASE_URL=\"\"<\/pre>\n<h3>.env.development<\/h3>\n<p>\u958b\u767a\u6642\u306b\u306f\u3001\u53d6\u5f97\u5143\u3067\u306f\u306a\u3044\u30db\u30b9\u30c8\u3092\u547c\u3073\u51fa\u3059\u3002<\/p>\n<pre class=\"prettyprint linenums\">VUE_APP_API_BASE_URL=\"http:\/\/localhost:8080\"<\/pre>\n<h3>1.4.Vue(axios)\u306b\u3088\u308b\u3001REST\u3000API\u547c\u3073\u51fa\u3057<\/h3>\n<p>\u5909\u66f4\u524d\u306e\u72b6\u614b\u306f\u3001<a href=\"https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/20\/google_app_engine_java_spring_bootvuetifyajax\">https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/20\/google_app_engine_java_spring_bootvuetifyajax<\/a><\/p>\n<pre class=\"prettyprint linenums\">&lt;script&gt;\r\nimport axios from 'axios';\r\n\r\nexport default {\r\n  name: 'FavPhrase',\r\n  methods: {\r\n    sampleAjax : function() {\r\n      axios.get(process.env.VUE_APP_API_BASE_URL + \"\/api\/hello\")\r\n        .then((res) =&gt; {\r\n          alert(\"status=\" + res.status + \":\" + res.data);\r\n        });\r\n    }\r\n  }\r\n}\r\n&lt;\/script&gt;\r\n<\/pre>\n<h3>1.5 \u30b5\u30fc\u30d0\u30fc(Spring MVC) \u5074<\/h3>\n<h3><\/h3>\n<p>\u5909\u66f4\u524d\u306e\u72b6\u614b <a href=\"https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/20\/google_app_engine_java_spring_bootvuetifyajax\">https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/20\/google_app_engine_java_spring_bootvuetifyajax<\/a>&nbsp; \u3067\u306f\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u30fc\u306b Oigin \u304c\u542b\u307e\u308c\u306a\u3044\u3068\u30b7\u30b0\u30cd\u30c1\u30e3\u304c\u4e00\u81f4\u3057\u306a\u3044\u305f\u3081\u3001\u5bfe\u5fdcAPI\u306a\u3057\u3068\u306a\u3063\u3066\u3057\u307e\u3046\u3002RequestHeader \u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3001required=false \u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint linenums\">@RestController\r\npublic class ApiController {\r\n\t@GetMapping(\"\/api\/hello\")\r\n\tpublic ResponseEntity<string> hello(\r\n\t\t\t@RequestHeader(name=\"Origin\", required=false) String origin) {\r\n\t\t\r\n\t\tSystem.out.println(String.format(\"%s\", origin));\r\n\t\t\r\n\t\tHttpHeaders headers = new HttpHeaders();\r\n\t\theaders.add(\"Access-Control-Allow-Origin\", origin);\r\n\t\t\r\n\t\tString body = \"Hello GAE Java std env with Spring boot !\";\r\n\t\treturn new ResponseEntity&lt;&gt;(body, headers, HttpStatus.OK );\r\n\t}\r\n}\r\n<\/string><\/pre>\n<h2>2.\u5b9f\u884c<\/h2>\n<h3>2.1 UI \u3001API\u305d\u308c\u305e\u308c\u5225\u306b\u5b9f\u884c<\/h3>\n<p>Vue \u3092 node \u306e devServer \u3067\u8d77\u52d5(8081\u30dd\u30fc\u30c8)\u753b\u9762\u304b\u3089\u3001API(8080\u30dd\u30fc\u30c8)\u306e\u547c\u3073\u51fa\u3057\u6210\u529f<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/vs2eclipse.png\"><img loading=\"lazy\" decoding=\"async\" width=\"658\" height=\"382\" title=\"vs2eclipse\" style=\"display: inline; background-image: none;\" alt=\"vs2eclipse\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/vs2eclipse_thumb.png\" border=\"0\"><\/a><\/p>\n<h3>2.2 Spring Boot\u306b\u7d71\u5408\u3057\u305fUI\u304b\u3089\u5b9f\u884c<\/h3>\n<p>npm run buid \u306b\u3088\u308a\u3001Spring Boot \u306e\u9759\u7684\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u5410\u304d\u51fa\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3(8080\u30dd\u30fc\u30c8)\u3092\u5b9f\u884c\u3057API(8080\u30dd\u30fc\u30c8)\u3092\u547c\u3073\u51fa\u3057\u3002\u6210\u529f\uff01<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/oneclipse.png\"><img loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"364\" title=\"oneclipse\" style=\"display: inline; background-image: none;\" alt=\"oneclipse\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/oneclipse_thumb.png\" border=\"0\"><\/a><\/p>\n<h3>2.3 GAE\u3067\u5b9f\u884c<\/h3>\n<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/06\/google_app_engine_java_spring_bootvuejs\">Eclipse \u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8<\/a>\u304b\u3089\u3001 mvn appengine:deploy \u3092\u5b9f\u884c\u3057\u3001gloud app browse \u6210\u529f\uff01<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/cors_gae_success.png\"><img loading=\"lazy\" decoding=\"async\" width=\"663\" height=\"375\" title=\"cors_gae_success\" style=\"display: inline; background-image: none;\" alt=\"cors_gae_success\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Google-App-Engine-Java---Spring-BootVuet_DF92\/cors_gae_success_thumb.png\" border=\"0\"><\/a><\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u4e00\u6b69\u91ce\u671b\u306b\u8fd1\u3065\u3044\u305f\u3002<\/p>\n<p><a href=\"https:\/\/www.amazon.co.jp\/Spring%E5%BE%B9%E5%BA%95%E5%85%A5%E9%96%80-Spring-Framework%E3%81%AB%E3%82%88%E3%82%8BJava%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E9%96%8B%E7%99%BA-%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BENTT%E3%83%87%E3%83%BC%E3%82%BF\/dp\/4798142476\/ref=as_li_ss_il?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&amp;keywords=Spring+boot&amp;qid=1556092118&amp;s=gateway&amp;sr=8-3&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=e930d891c0aeddf94e72417750fa897b\" target=\"_blank\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=4798142476&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" border=\"0\"><\/a><img loading=\"lazy\" decoding=\"async\" width=\"1\" height=\"1\" style=\"margin: 0px !important; border: currentcolor !important; border-image: none !important;\" alt=\"\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=li2&amp;o=9&amp;a=4798142476\" border=\"0\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3082\u3063\u3066\u3044\u304d\u305f\u3044\u69cb\u6210\u306f\u3001\u4ee5\u4e0b\u3002 Eclipse \u4e0a\u3067\u3001API\u306e\u958b\u767a\u3001Visual Studio Code\u4e0a\u3067\u3001UI\u306e\u958b\u767a\u3092\u305d\u308c\u305e\u308c\u884c\u3044\u3001UI \u306e\u30d3\u30eb\u30c9 -&gt; Eclipse\u5074\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u66f8\u304d\u51fa\u3057 -&#038;g [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[19,47,107],"tags":[],"class_list":["post-548","post","type-post","status-publish","format-standard","hentry","category-googleappengine","category-spring","category-vue-js"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=548"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/548\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}