Skip to content

Commit 9ac80a8

Browse files
author
Alian Rignack Quevedo
committed
Add PWA support and service worker
1 parent a119663 commit 9ac80a8

12 files changed

+124
-0
lines changed

ngsw-config.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
3+
"index": "/index.html",
4+
"assetGroups": [
5+
{
6+
"name": "app",
7+
"installMode": "prefetch",
8+
"resources": {
9+
"files": [
10+
"/favicon.ico",
11+
"/index.html",
12+
"/manifest.webmanifest",
13+
"/*.css",
14+
"/*.js"
15+
]
16+
}
17+
}, {
18+
"name": "assets",
19+
"installMode": "lazy",
20+
"updateMode": "prefetch",
21+
"resources": {
22+
"files": [
23+
"/assets/**",
24+
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
25+
]
26+
}
27+
}
28+
]
29+
}

src/app/services/api.service.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { TestBed } from '@angular/core/testing';
2+
3+
import { ApiService } from './api.service';
4+
5+
describe('ApiService', () => {
6+
let service: ApiService;
7+
8+
beforeEach(() => {
9+
TestBed.configureTestingModule({});
10+
service = TestBed.inject(ApiService);
11+
});
12+
13+
it('should be created', () => {
14+
expect(service).toBeTruthy();
15+
});
16+
});

src/app/services/api.service.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Injectable } from '@angular/core';
2+
import { HttpClient } from '@angular/common/http';
3+
import { Observable } from 'rxjs';
4+
export interface Item {
5+
name: string;
6+
description: string;
7+
url: string;
8+
html: string;
9+
markdown: string;
10+
}
11+
@Injectable({
12+
providedIn: 'root'
13+
})
14+
export class ApiService {
15+
private baseURL: string = "https://www.techiediaries.com/api/data.json";
16+
constructor(private httpClient: HttpClient) { }
17+
fetch(): Observable<Item[]> {
18+
return <Observable<Item[]>>this.httpClient.get(this.baseURL);
19+
}
20+
}

src/assets/icons/icon-128x128.png

1.22 KB
Loading

src/assets/icons/icon-144x144.png

1.36 KB
Loading

src/assets/icons/icon-152x152.png

1.39 KB
Loading

src/assets/icons/icon-192x192.png

1.75 KB
Loading

src/assets/icons/icon-384x384.png

3.47 KB
Loading

src/assets/icons/icon-512x512.png

4.89 KB
Loading

src/assets/icons/icon-72x72.png

792 Bytes
Loading

0 commit comments

Comments
 (0)