Skip to content

Commit e2e4f88

Browse files
committed
ionic angular rest initial
1 parent c1dd1e5 commit e2e4f88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+18589
-0
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Specifies intentionally untracked files to ignore when using Git
2+
# http://git-scm.com/docs/gitignore
3+
4+
*~
5+
*.sw[mnpcod]
6+
.tmp
7+
*.tmp
8+
*.tmp.*
9+
*.sublime-project
10+
*.sublime-workspace
11+
.DS_Store
12+
Thumbs.db
13+
UserInterfaceState.xcuserstate
14+
$RECYCLE.BIN/
15+
16+
*.log
17+
log.txt
18+
npm-debug.log*
19+
20+
/.idea
21+
/.ionic
22+
/.sass-cache
23+
/.sourcemaps
24+
/.versions
25+
/.vscode
26+
/coverage
27+
/dist
28+
/node_modules
29+
/platforms
30+
/plugins
31+
/www

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12.16

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package.json
2+
package-lock.json
3+
dist
4+
.angulardoc.json
5+
.vscode/*

.prettierrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"bracketSpacing": true,
5+
"tabWidth": 2,
6+
"useTabs": false,
7+
"trailingComma": "none"
8+
}

LICENSE.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 David Buck
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Ionic Angular Rest Example
2+
3+
This is a simple [Ionic Angular](https://ionicframework.com/docs/angular/overview) example showing how to consume a restful API.
4+
5+
Run `npm run start` to start the JSON server and the Ionic client.
6+
7+
This version uses @ionic/angular 5.0.7 & @angular 9.1.2.
8+
9+
## Tools
10+
11+
- [JSON Server](https://github.com/typicode/json-server)

angular.json

+187
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"defaultProject": "app",
5+
"newProjectRoot": "projects",
6+
"projects": {
7+
"app": {
8+
"root": "",
9+
"sourceRoot": "src",
10+
"projectType": "application",
11+
"prefix": "app",
12+
"schematics": {},
13+
"architect": {
14+
"build": {
15+
"builder": "@angular-devkit/build-angular:browser",
16+
"options": {
17+
"outputPath": "www",
18+
"index": "src/index.html",
19+
"main": "src/main.ts",
20+
"polyfills": "src/polyfills.ts",
21+
"tsConfig": "tsconfig.app.json",
22+
"assets": [
23+
{
24+
"glob": "**/*",
25+
"input": "src/assets",
26+
"output": "assets"
27+
},
28+
{
29+
"glob": "**/*.svg",
30+
"input": "node_modules/ionicons/dist/ionicons/svg",
31+
"output": "./svg"
32+
}
33+
],
34+
"styles": [
35+
{
36+
"input": "src/theme/variables.scss"
37+
},
38+
{
39+
"input": "src/global.scss"
40+
}
41+
],
42+
"scripts": []
43+
},
44+
"configurations": {
45+
"production": {
46+
"fileReplacements": [
47+
{
48+
"replace": "src/environments/environment.ts",
49+
"with": "src/environments/environment.prod.ts"
50+
}
51+
],
52+
"optimization": true,
53+
"outputHashing": "all",
54+
"sourceMap": false,
55+
"extractCss": true,
56+
"namedChunks": false,
57+
"aot": true,
58+
"extractLicenses": true,
59+
"vendorChunk": false,
60+
"buildOptimizer": true,
61+
"budgets": [
62+
{
63+
"type": "initial",
64+
"maximumWarning": "2mb",
65+
"maximumError": "5mb"
66+
}
67+
]
68+
},
69+
"ci": {
70+
"progress": false
71+
}
72+
}
73+
},
74+
"serve": {
75+
"builder": "@angular-devkit/build-angular:dev-server",
76+
"options": {
77+
"browserTarget": "app:build"
78+
},
79+
"configurations": {
80+
"production": {
81+
"browserTarget": "app:build:production"
82+
},
83+
"ci": {
84+
"progress": false
85+
}
86+
}
87+
},
88+
"extract-i18n": {
89+
"builder": "@angular-devkit/build-angular:extract-i18n",
90+
"options": {
91+
"browserTarget": "app:build"
92+
}
93+
},
94+
"test": {
95+
"builder": "@angular-devkit/build-angular:karma",
96+
"options": {
97+
"main": "src/test.ts",
98+
"polyfills": "src/polyfills.ts",
99+
"tsConfig": "tsconfig.spec.json",
100+
"karmaConfig": "karma.conf.js",
101+
"styles": [],
102+
"scripts": [],
103+
"assets": [
104+
{
105+
"glob": "favicon.ico",
106+
"input": "src/",
107+
"output": "/"
108+
},
109+
{
110+
"glob": "**/*",
111+
"input": "src/assets",
112+
"output": "/assets"
113+
}
114+
]
115+
},
116+
"configurations": {
117+
"ci": {
118+
"progress": false,
119+
"watch": false
120+
}
121+
}
122+
},
123+
"lint": {
124+
"builder": "@angular-devkit/build-angular:tslint",
125+
"options": {
126+
"tsConfig": [
127+
"tsconfig.app.json",
128+
"tsconfig.spec.json",
129+
"e2e/tsconfig.json"
130+
],
131+
"exclude": ["**/node_modules/**"]
132+
}
133+
},
134+
"e2e": {
135+
"builder": "@angular-devkit/build-angular:protractor",
136+
"options": {
137+
"protractorConfig": "e2e/protractor.conf.js",
138+
"devServerTarget": "app:serve"
139+
},
140+
"configurations": {
141+
"production": {
142+
"devServerTarget": "app:serve:production"
143+
},
144+
"ci": {
145+
"devServerTarget": "app:serve:ci"
146+
}
147+
}
148+
},
149+
"ionic-cordova-build": {
150+
"builder": "@ionic/angular-toolkit:cordova-build",
151+
"options": {
152+
"browserTarget": "app:build"
153+
},
154+
"configurations": {
155+
"production": {
156+
"browserTarget": "app:build:production"
157+
}
158+
}
159+
},
160+
"ionic-cordova-serve": {
161+
"builder": "@ionic/angular-toolkit:cordova-serve",
162+
"options": {
163+
"cordovaBuildTarget": "app:ionic-cordova-build",
164+
"devServerTarget": "app:serve"
165+
},
166+
"configurations": {
167+
"production": {
168+
"cordovaBuildTarget": "app:ionic-cordova-build:production",
169+
"devServerTarget": "app:serve:production"
170+
}
171+
}
172+
}
173+
}
174+
}
175+
},
176+
"cli": {
177+
"defaultCollection": "@ionic/angular-toolkit"
178+
},
179+
"schematics": {
180+
"@ionic/angular-toolkit:component": {
181+
"styleext": "scss"
182+
},
183+
"@ionic/angular-toolkit:page": {
184+
"styleext": "scss"
185+
}
186+
}
187+
}

browserslist

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# You can see what browsers were selected by your queries by running:
6+
# npx browserslist
7+
8+
> 0.5%
9+
last 2 versions
10+
Firefox ESR
11+
not dead
12+
not IE 9-11 # For IE 9-11 support, remove 'not'.

db.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"posts": [
3+
{
4+
"id": 1,
5+
"postid": 1,
6+
"title": "title 1",
7+
"author": "Test"
8+
},
9+
{
10+
"id": 2,
11+
"postid": 2,
12+
"title": "title 2",
13+
"author": "Test"
14+
},
15+
{
16+
"id": 3,
17+
"postid": 3,
18+
"title": "title 3",
19+
"author": "Test"
20+
}
21+
]
22+
}

e2e/protractor.conf.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Protractor configuration file, see link for more information
2+
// https://github.com/angular/protractor/blob/master/lib/config.ts
3+
4+
const { SpecReporter } = require('jasmine-spec-reporter');
5+
6+
exports.config = {
7+
allScriptsTimeout: 11000,
8+
specs: [
9+
'./src/**/*.e2e-spec.ts'
10+
],
11+
capabilities: {
12+
'browserName': 'chrome'
13+
},
14+
directConnect: true,
15+
baseUrl: 'http://localhost:4200/',
16+
framework: 'jasmine',
17+
jasmineNodeOpts: {
18+
showColors: true,
19+
defaultTimeoutInterval: 30000,
20+
print: function() {}
21+
},
22+
onPrepare() {
23+
require('ts-node').register({
24+
project: require('path').join(__dirname, './tsconfig.json')
25+
});
26+
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27+
}
28+
};

e2e/src/app.e2e-spec.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { AppPage } from './app.po';
2+
3+
describe('new App', () => {
4+
let page: AppPage;
5+
6+
beforeEach(() => {
7+
page = new AppPage();
8+
});
9+
10+
it('should be blank', () => {
11+
page.navigateTo();
12+
expect(page.getParagraphText()).toContain('The world is your oyster.');
13+
});
14+
});

e2e/src/app.po.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, by, element } from 'protractor';
2+
3+
export class AppPage {
4+
navigateTo() {
5+
return browser.get('/');
6+
}
7+
8+
getParagraphText() {
9+
return element(by.deepCss('app-root ion-content')).getText();
10+
}
11+
}

e2e/tsconfig.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../out-tsc/app",
5+
"module": "commonjs",
6+
"target": "es5",
7+
"types": [
8+
"jasmine",
9+
"jasminewd2",
10+
"node"
11+
]
12+
}
13+
}

ionic.config.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "ionic-rest",
3+
"integrations": {},
4+
"type": "angular"
5+
}

0 commit comments

Comments
 (0)