Skip to content

Instantly share code, notes, and snippets.

View open
ionic capacitor open ios
View install deploy utilyty
npm install -g ios-sim
brew install ios-deploy
View ionic serve
cd ionic-first-app
ionic serve
View javascript"", "_blank", "noreferrer")
View html
<a href="" target="_blank" rel=“noopener noreferrer”>
View call api
export class AppComponent implements OnInit {
soccerData = '';
baseballData = '';
constructor(private http: HttpClient){}
ngOnInit():void {
View server.js
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()
"/api/*": "/$1" // /api/soccer -> /soccer
View angular.json
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"proxyConfig": "mock/proxy.conf.json"
"configurations": {
"production": {
"browserTarget": "json-server-sample:build:production"
"development": {
View proxy.conf.json
"/api": {
"target": "http://localhost:3000",
"secure": false
View start mock
"scripts": {
"ng": "ng",
"start": "ng serve",
"mock": "node ./mock/server.js",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"