This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="https://www.ksakae1216.com/archive" target="_blank" rel=“noopener noreferrer”> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class AppComponent implements OnInit { | |
soccerData = ''; | |
baseballData = ''; | |
constructor(private http: HttpClient){} | |
ngOnInit():void { | |
this.getData('soccer'); | |
this.getData('baseball'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jsonServer = require('json-server') | |
const server = jsonServer.create() | |
const path = require('path') | |
const router = jsonServer.router(path.join(__dirname, 'db.json')) // 今回のようにmockディレクトリ作成して別のフォルダでmock起動するときは必要 | |
const middlewares = jsonServer.defaults() | |
server.use(jsonServer.rewriter({ | |
"/api/*": "/$1" // /api/soccer -> /soccer | |
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"serve": { | |
"builder": "@angular-devkit/build-angular:dev-server", | |
"options": { | |
"proxyConfig": "mock/proxy.conf.json" | |
}, | |
"configurations": { | |
"production": { | |
"browserTarget": "json-server-sample:build:production" | |
}, | |
"development": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"/api": { | |
"target": "http://localhost:3000", | |
"secure": false | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"ng": "ng", | |
"start": "ng serve", | |
"mock": "node ./mock/server.js", | |
"build": "ng build", | |
"watch": "ng build --watch --configuration development", | |
"test": "ng test" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"soccer": [ | |
{ "id": 7, "name": "kubo", "position": "MF", "createdAt": "2021/08/09 10:00:00" }, | |
{ "id": 10, "name": "doan", "position": "MF", "createdAt": "2021/08/09 10:00:00"}, | |
{ "id": 4, "name": "yoshida", "position": "CB", "createdAt": "2021/08/09 10:00:00"} | |
], | |
"baseball": [ | |
{ "id": 6, "name": "sakamoto", "position": "ショート", "createdAt": "2021/08/09 10:00:00" }, | |
{ "id": 51, "name": "suzuki", "position": "センター", "createdAt": "2021/08/09 10:00:00" } | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add --dev json-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ng @briebug/jest-schematic:add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install @briebug/jest-schematic |