{"id":7824,"date":"2017-04-19T15:36:37","date_gmt":"2017-04-19T06:36:37","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=7824"},"modified":"2017-04-19T15:38:59","modified_gmt":"2017-04-19T06:38:59","slug":"rails5-api%e3%83%a2%e3%83%bc%e3%83%89-angular-spa%e7%92%b0%e5%a2%83-%e7%88%86%e9%80%9f%e6%a7%8b%e7%af%89%e3%81%ae%e6%89%8b%e9%a0%86-%e3%81%9d%e3%81%ae2%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=7824","title":{"rendered":"Rails5 API\u30e2\u30fc\u30c9 + Angular SPA\u74b0\u5883 \u7206\u901f\u69cb\u7bc9\u306e\u624b\u9806 \u305d\u306e2\u3002"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-7832\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/rails-angular00.jpg\" alt=\"\" width=\"605\" height=\"195\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/rails-angular00.jpg 912w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/rails-angular00-300x97.jpg 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/rails-angular00-768x248.jpg 768w\" sizes=\"auto, (max-width: 605px) 100vw, 605px\" \/><\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/?p=7816\">\u524d\u56de<\/a>\u306e\u7d9a\u304d\u3067\u3059\u3002<\/p>\n<p><strong>GitHub<\/strong><\/p>\n<p class=\"public \"><a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/tree\/step_connection\" target=\"_blank\"><strong>rails-api-angular-example<\/strong><\/a><\/p>\n<p>\u4eca\u56de\u306f\u30d6\u30e9\u30f3\u30c1\u540d\u300c<strong>step_connection<\/strong>\u300d\u306b\u5207\u308a\u66ff\u3048\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<h4>Rails \u30c7\u30fc\u30bf\u4f5c\u6210<\/h4>\n<p>\u3067\u306f\u3001\u65e9\u901fRails\u3092\u7528\u3044\u3066\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>rails generate scaffold \u30b3\u30de\u30f3\u30c9\u3067user\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ rails generate scaffold user name:string<\/pre>\n<p>migrate\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u306e\u3067\u3001migrate\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ rails db:migrate<\/pre>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067\u4ee5\u4e0b\u306eURL\u3092\u78ba\u8a8d\u3002<\/p>\n<p><a href=\"http:\/\/localhost:4200\/users\" target=\"_blank\">http:\/\/localhost:4200\/users<\/a><\/p>\n<p>\u307e\u305f\u306f\u3001curl\u30b3\u30de\u30f3\u30c9\u3067\u78ba\u8a8d\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ curl http:\/\/localhost:4200\/user<\/pre>\n<p>\u3059\u308b\u3068\u3001\u7a7a\u306e\u914d\u5217\u304c\u8fd4\u5374\u3055\u308c\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">&#x5B;]<\/pre>\n<p>rails console\u306b\u3066\u3001User\u306e\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\u3001\u633f\u5165\u3057\u307e\u3059\u3002<\/p>\n<p><strong>rails console<\/strong><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ rails c<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ user = User.new(name:'daisuke.takayama');<\/pre>\n<p>&#8216;daisuke.takayama&#8217;\u306e name\u3092\u6301\u3063\u305f\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3002<\/p>\n<p>\u4fdd\u5b58\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ user.save<\/pre>\n<p>\u518d\u3073\u3001\u30d6\u30e9\u30a6\u30b6 \u307e\u305f\u306f curl\u30b3\u30de\u30f3\u30c9\u3067\u78ba\u8a8d\u3059\u308b\u3068\u3001user\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">&#x5B;{\"id\":1,\"name\":\"daisuke.takayama\",\"created_at\":\"2017-04-09T11:49:55.040Z\",\"updated_at\":\"2017-04-09T11:49:55.040Z\"}]<\/pre>\n<h4>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u4f5c\u6210 &#038; router\u8ffd\u52a0<\/h4>\n<p>User\u306e\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\u51fa\u6765\u307e\u3057\u305f\u306e\u3067\u3001Angular\u5074\u306e\u4f5c\u696d\u3092\u884c\u306a\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/commit\/24e0bb969a56917d6775a631db3f28ffcb8cff86\">commit<\/a><\/p>\n<p>ng\u30b3\u30de\u30f3\u30c9\u3067\u3001\u300cuser\u300d\u306e\u3001component\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ ng g component user<\/pre>\n<p>\u4ee5\u4e0b\u306e\u69d8\u306b\u300ccomponent\u300d\u306a\u3069\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5207\u3063\u3066\u307e\u3068\u3081\u305f\u65b9\u304c\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u4eca\u56de\u306f\u3068\u308a\u3042\u3048\u305a\u305d\u306e\u307e\u307e\u3067\u4f5c\u6210\u3057\u3066\u9032\u3081\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ ng g component component\/user<\/pre>\n<p><strong>app\/user\/user.component.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { Component, OnInit } from '@angular\/core';\r\n\r\n@Component({\r\n  selector: 'app-user',\r\n  templateUrl: '.\/user.component.html',\r\n  styleUrls: &#x5B;'.\/user.component.css']\r\n})\r\nexport class UserComponent implements OnInit {\r\n\r\n  constructor() { }\r\n\r\n  ngOnInit() {\r\n\r\n  }\r\n\r\n}<\/pre>\n<p>onInit\u306einterface\u3092implements\u7528\u3044\u3066\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<h5>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u8a2d\u5b9a<\/h5>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/commit\/3c7be2ee9158a43a6e13eea07bcf876b0d781bf6\" target=\"_blank\">ng g component user &#038; add routing<\/a><\/p>\n<p>Angular CLI\u3092\u7528\u3044\u3066\u3044\u308b\u5834\u5408\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u969b\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u4f34\u3046\u30d5\u30a1\u30a4\u30eb\u3082\u4f5c\u6210\u3068\u540c\u6642\u306b\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ ng new your-project --routing<\/pre>\n<p>\u3067\u3059\u304c\u3001\u4eca\u56de \u4e0a\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u306f\u884c\u306a\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u624b\u52d5\u3067\u300capp-routing.module.ts\u300d\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/app-routing.module.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { NgModule } from '@angular\/core';\r\nimport { Routes, RouterModule } from '@angular\/router';\r\nimport { UserComponent } from '.\/user\/user.component';\r\n\r\nconst routes: Routes = &#x5B;\r\n  {\r\n    path: 'users',\r\n    component: UserComponent,\r\n    children: &#x5B;]\r\n  }\r\n];\r\n\r\n@NgModule({\r\n  imports: &#x5B;RouterModule.forRoot(routes)],\r\n  exports: &#x5B;RouterModule]\r\n})\r\nexport class AppRoutingModule { }<\/pre>\n<p>NgModule\u3001component\u3001@angular\/route\u3092\u305d\u308c\u305e\u308cimport\u3002<\/p>\n<p>\u300cuser\u300d\u306e URL path\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h4>add routerLink<\/h4>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/commit\/3c7be2ee9158a43a6e13eea07bcf876b0d781bf6\" target=\"_blank\">ng g component user &#038; add routing<\/a><\/p>\n<p><strong>app\/user\/user.component.html<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;h1&gt;\r\n  {{title}}\r\n&lt;\/h1&gt;\r\n&lt;a routerLink=&quot;\/users&quot; routerLinkActive=&quot;active&quot;&gt;users&lt;\/a&gt;\r\n  \r\n&lt;router-outlet&gt;&lt;\/router-outlet&gt;<\/pre>\n<h4>useHash\u30aa\u30d7\u30b7\u30e7\u30f3\u8ffd\u52a0<\/h4>\n<p>API\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3068\u3001\u30d5\u30ed\u30f3\u30c8\u306eURL\u3092\u5206\u96e2\u3059\u308b\u305f\u3081\u306b\u3001useHash\u30aa\u30d7\u30b7\u30e7\u30f3\u3092true\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u3092\u884c\u3046\u3053\u3068\u306b\u3088\u3063\u3066\u3001URL\u306f\u300chttp:\/\/hoge\/#\/\u300d \u306e\u69d8\u306b\u300c#\u300d\u304croot\u3068\u306a\u308bURL\u306b\u8a2d\u5b9a\u3059\u308b\u4e8b\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/commit\/d3034e2a47c1857e0b5e645b7a52cf867e07682f\" target=\"_blank\">add routes option useHash<\/a><\/p>\n<p><strong>app\/app-routing.module.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { NgModule } from '@angular\/core';\r\nimport { Routes, RouterModule } from '@angular\/router';\r\nimport { UserComponent } from '.\/user\/user.component';\r\n\r\nconst routes: Routes = &#x5B;\r\n  {\r\n    path: 'users',\r\n    component: UserComponent,\r\n    children: &#x5B;]\r\n  }\r\n];\r\n\r\n@NgModule({\r\n  imports: &#x5B;RouterModule.forRoot(routes, { useHash: true })],\r\n  exports: &#x5B;RouterModule]\r\n})\r\nexport class AppRoutingModule { }<\/pre>\n<h4>User \u30b5\u30fc\u30d3\u30b9\u30af\u30e9\u30b9\u4f5c\u6210<\/h4>\n<p>User\u306b\u95a2\u3059\u308b\u30c7\u30fc\u30bf\u3092http\u901a\u4fe1\u884c\u3048\u308b\u3088\u3046\u306b\u3001\u30b5\u30fc\u30d3\u30b9\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/commit\/3aa733c1a07dba119e538fbe95f7ad07aefbf63d\" target=\"_blank\">ng g service user<\/a><\/p>\n<p>\u300cng g service\u300d\u30b3\u30de\u30f3\u30c9\u3067\u3001\u300cuser\u300d\u306e\u30b5\u30fc\u30d3\u30b9\u30af\u30e9\u30b9\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ ng g service user<\/pre>\n<p><strong>app\/user.service.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { Injectable } from '@angular\/core';\r\n\r\n@Injectable()\r\nexport class UserService {\r\n\r\n  constructor() { }\r\n\r\n}<\/pre>\n<h4>User \u62bd\u8c61\u30af\u30e9\u30b9\u4f5c\u6210<\/h4>\n<p>\u300cng g class\u300d\u30b3\u30de\u30f3\u30c9\u3092\u7528\u3044\u3066\u3001\u300cuser\u300d\u306e\u62bd\u8c61\u30af\u30e9\u30b9\u3067\u3042\u308b\u300cUser\u300d\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ ng g class user<\/pre>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/commit\/ecda4ccb8d7c5312fe2cb79c61126dfafe5de384\" target=\"_blank\">ng g class user<\/a><\/p>\n<p><strong>app\/user.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">export class User {\r\n}<\/pre>\n<h4>User \u62bd\u8c61\u30af\u30e9\u30b9 \u30d7\u30ed\u30d1\u30c6\u30a3\u8ffd\u52a0<\/h4>\n<p>DB\u30c7\u30fc\u30bf\u3067\u300cname\u300d\u30ab\u30e9\u30e0\u3092\u4fdd\u6301\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u308c\u3068\u5bfe\u3068\u306a\u308b\u300cname\u300d\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/commit\/e963ade7688a7fd9d04459e9453ed5b71d82a617\" target=\"_blank\">add user class property<\/a><\/p>\n<p><strong>app\/user.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">export class User {\r\n  name: string;\r\n}<\/pre>\n<h4>UserService class\u306e\u5b9f\u88c5<\/h4>\n<p>UserService class\u306e\u5b9f\u88c5\u3092\u884c\u306a\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/commit\/0fa07a7b5e0916ba87436cbce8c39aaae1153758\" target=\"_blank\">create UserService<\/a><\/p>\n<p><strong>app\/user.service.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { Injectable } from '@angular\/core';\r\nimport { Http, Headers, Response } from '@angular\/http';\r\nimport { Observable } from 'rxjs\/Observable';\r\n\r\nimport { User } from '.\/user';\r\n\r\nimport 'rxjs\/add\/operator\/map';\r\nimport 'rxjs\/add\/operator\/catch';\r\n\r\n@Injectable()\r\nexport class UserService {\r\n  private userUrl = '\/users';\r\n\r\n  constructor (private http: Http) {}\r\n\r\n  getUser(): Observable&lt;User&#x5B;]&gt; {\r\n    return this.http.get(this.userUrl)\r\n      .map(this.extractData)\r\n      .catch(this.handleError);\r\n  }\r\n\r\n  \/\/ \u30ec\u30b9\u30dd\u30f3\u30b9\u30c7\u30fc\u30bf\u6574\u5f62\r\n  private extractData(res: Response) {\r\n    if (res.status &lt; 200 || res.status &gt;= 300) {\r\n      throw new Error('Bad response status: ' + res.status);\r\n    }\r\n    let body = res.json();\r\n\r\n    return body || { };\r\n  }\r\n\r\n  \/\/ \u30a8\u30e9\u30fc\u51e6\u7406\r\n  private handleError(error: any) {\r\n    let errMsg = error.message || 'Server error';\r\n\r\n    return Observable.throw(errMsg);\r\n  }\r\n\r\n}<\/pre>\n<p>&#8216;\/users&#8217;\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u304b\u3089\u3001\u8a72\u5f53\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<p>getUser\u95a2\u6570\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001User\u306e\u914d\u5217\u3092\u3092\u6301\u3063\u305fObservable\u578b\u3067\u8fd4\u5374\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/user\/user.component.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { Component, OnInit } from '@angular\/core';\r\nimport { UserService } from '..\/user.service';\r\n\r\nimport { User } from '..\/user';\r\n\r\n@Component({\r\n  selector: 'app-user',\r\n  templateUrl: '.\/user.component.html',\r\n  styleUrls: &#x5B;'.\/user.component.css'],\r\n  providers: &#x5B;UserService]\r\n})\r\nexport class UserComponent implements OnInit {\r\n  users: User&#x5B;];\r\n\r\n  constructor(private userService: UserService) { }\r\n\r\n  getUser(): void {\r\n    this.userService.getUser()\r\n      .subscribe((users) =&gt; {\r\n        this.users = users;\r\n      });\r\n  }\r\n\r\n  ngOnInit() {\r\n    this.getUser();\r\n  }\r\n}<\/pre>\n<p>HTML\u5074\u306f\u3001users\u306e\u6570\u3060\u3051ngFor\u3067\u7e70\u308a\u8fd4\u3057\u3001\u63cf\u753b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/user\/user.component.html<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;p&gt;\r\n  user works!\r\n&lt;\/p&gt;\r\n\r\n&lt;ul class=&quot;userList&quot; *ngIf=&quot;users&quot;&gt;\r\n  &lt;li *ngFor=&quot;let user of users&quot;&gt;\r\n    &lt;p&gt;ID: &lt;span&gt;{{user.id}}&lt;\/span&gt;&lt;\/p&gt;\r\n    &lt;p&gt;\u540d\u524d: &lt;span&gt;{{user.name}}&lt;\/span&gt;&lt;\/p&gt;\r\n  &lt;\/li&gt;\r\n&lt;\/ul&gt;<\/pre>\n<h4>\u30d3\u30eb\u30c9<\/h4>\n<p>\u6700\u5f8c\u306b\u30d3\u30eb\u30c9\u30b3\u30de\u30f3\u30c9\uff08ng build &#8211;prod\uff09\u3092\u884c\u3044\u3001digest\u4ed8\u304d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u751f\u6210\u3002<\/p>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/webcyou\/rails-api-angular-example\/commit\/708f7937bbed1b296871ee2bab07e869445bbc8d\n\" target=\"_blank\">ng build &#8211;prod<\/a><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ ng build --prod<\/pre>\n<p>\u305d\u308c\u3067\u306f\u3001\u78ba\u8a8d\u3002<\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067\u4ee5\u4e0b\u306eURL\u3092\u8868\u793a\u3002<br \/>\n<a href=\"http:\/\/localhost:3000\/\" target=\"_blank\">http:\/\/localhost:3000\/<\/a><\/p>\n<p>\u300cusers\u300d\u306e\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001\u4ee5\u4e0b\u306e\u69d8\u306b\u30e6\u30fc\u30b6\u30fc\u306e\u60c5\u5831\u304c\u8868\u793a\u3055\u308c\u308c\u3070\u6210\u529f\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/aa2d75a84a405d2cc8ee3b33651a47c4.png\" alt=\"\" width=\"300\" class=\"alignnone size-full wp-image-7854\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/aa2d75a84a405d2cc8ee3b33651a47c4.png 546w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/aa2d75a84a405d2cc8ee3b33651a47c4-300x255.png 300w\" sizes=\"(max-width: 546px) 100vw, 546px\" \/><\/p>\n<h4>\u6700\u5f8c\u306b<\/h4>\n<p>\u3068\u3001Rails5 API\u30e2\u30fc\u30c9 + Angular SPA\u74b0\u5883 \u7206\u901f\u69cb\u7bc9\u306e\u624b\u9806 \u305d\u306e2\u3002\u3067\u3057\u305f\u3002<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\u3002<\/p>\n<p>\u6b21\u56de\u306f\u3001\u8a8d\u8a3c\u30fb\u8a8d\u53ef\u5468\u308a\u306b\u3064\u3044\u3066\u8a18\u8ff0\u51fa\u6765\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u3041\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/angular2-1.png\" alt=\"\" width=\"600\" height=\"300\" class=\"alignnone size-full wp-image-7860\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/angular2-1.png 600w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/04\/angular2-1-300x150.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306e\u7d9a\u304d\u3067\u3059\u3002 GitHub rails-api-angular-example \u4eca\u56de\u306f\u30d6\u30e9\u30f3\u30c1\u540d\u300cstep_connection\u300d\u306b\u5207\u308a\u66ff\u3048\u3066\u304a\u308a\u307e\u3059\u3002 Rails \u30c7\u30fc\u30bf\u4f5c\u6210 \u3067\u306f\u3001\u65e9\u901fRails\u3092\u7528\u3044\u3066\u30c7\u30fc\u30bf\u3092\u4f5c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[203],"tags":[171,167,177,168,176,166,37,47,173,44,45,95,39,178,138,78,114,118],"class_list":{"0":"post-7824","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-angular2","7":"tag-android","8":"tag-css","9":"tag-css3","10":"tag-html","11":"tag-html5","12":"tag-iphone","13":"tag-iphone-","14":"tag-javascript-2","15":"tag-php","16":"tag-web","18":"tag-95","19":"tag-39","20":"tag-178","21":"tag-138","22":"tag-78","23":"tag-114","24":"tag-118"},"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/7824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7824"}],"version-history":[{"count":18,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/7824\/revisions"}],"predecessor-version":[{"id":7861,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/7824\/revisions\/7861"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}