GitHunt
ZA

ZakiMohammed/ng-cashew-app

๐Ÿฅœ NgCashew app to explore the air light @ngneat/cashew package to cache Angular HTTP requests powered by Cirrus UI.

๐Ÿฅœ NgCashew

Check out the CodeOmelet blog post for this project.

Link: https://codeomelet.com/posts/cache-angular-http-request-using-ngneat-cashew


NgCashew app to explore the air light @ngneat/cashew package to cache Angular HTTP requests powered by Cirrus UI.

Run Project

npm start

Add Cashew Package

npm i @ngneat/cashew

Add to App Modules

@NgModule({
  imports: [
    HttpClientModule, 
    HttpCacheInterceptorModule.forRoot(), 
    ...
  ],
})

Add to HTTP Service

Configure the options object:

private options = {
  context: withCache()
};

Pass it to get method:

getUsers() {
  const url = `${this.url}${this.userUrl}`;
  return this.http.get<any>(url, this.options);
}

Languages

TypeScript57.3%HTML28.4%SCSS14.3%

Contributors

Created May 22, 2023
Updated May 24, 2023
ZakiMohammed/ng-cashew-app | GitHunt