Category: exchange rates
-
Caching data backend–.NET Core–part 49
We have 2 options to cache data: One in webAPI,one when returns from database. For WebAPI,I have read https://docs.microsoft.com/en-us/aspnet/core/performance/caching/response?view=aspnetcore-3.1 and https://docs.microsoft.com/en-us/aspnet/core/performance/caching/middleware?view=aspnetcore-3.1 It is also important to read the conditions for caching : https://docs.microsoft.com/en-us/aspnet/core/performance/caching/middleware?view=aspnetcore-3.1#conditions-for-caching ( e.g. only GET or HEAD is cached) It is just very easy – see github commit https://github.com/ignatandrei/InfoValutar/commit/b8d38658b5135e4d3c93da78f77ffb9f01376829 Also,can be tested by…
-
Caching data frontend- Angular interceptors for Observable–part 48
Now I want to cache data for fast loading site- if it comes next time with the same browser,should have some data returned fast – and then load from HTTP. So first return from cache,then make the request So I need to create an HTTP interceptor to cache things- fortunately,Angular already provide tutorial about this:…
-
RxJS–Unsubscribe automatically –part 47
I am searching for a simple method to unsubscribe from Observables. Some of methods are detailed here : https://blog.bitsrc.io/6-ways-to-unsubscribe-from-observables-in-angular-ab912819a78f I do not want remember to unsubscribe being forced to use html ( the async pipe) take operator – I want later to cache first data and then make the http call first operator – same…
-
Displaying banks with Angular routing-part 45
Now I want to have a separate URL for each bank,like https://infovalutar.azurewebsites.net/bank/ECB For this I read routing in Angular,https://angular.io/tutorial/toh-pt5 . However,a small problem : when we change URL,from https://infovalutar.azurewebsites.net/bank/ECB to https://infovalutar.azurewebsites.net/bank/BNR we should re-load component – or the component be aware of changing. Reading https://kamranahmed.info/blog/2018/02/28/dealing-with-route-params-in-angular-5/ makes me change from this.idBank = this.route.snapshot.paramMap.get(‘id’); to this.route.params.subscribe(rp=> {…
-
Configure Angular Environment(local and remote) and CORS for .NET Core – part 43
I want to be capable to run Angular with data obtained from local .NET project in development – and from remote website in production. One of the techniques is detailed here https://angular.io/guide/build Generated service : ng g s banks Now I want to see that every modification of the Bankservice will re-compile. Tried in Docker…
-
Docker environment for Angular–part 42
Trying the alpine container from https://github.com/microsoft/vscode-dev-containers/tree/master/containers . It does not work – the error was that it cannot mount the binding folder . I figure that it was a Docker issue,https://blogs.msdn.microsoft.com/stevelasker/2016/06/14/configuring-docker-for-windows-volumes/ . Then I had a problem with “ tarball data for @angular/compiler@8.2.14 seems to be corrupted” – delete package.json for this. This is the…
-
Adding Angular to WebAPI site-part 41
First,I want to add an index.html file – to see the result. For this,I add to the startup: public void Configure(IApplicationBuilder app,IWebHostEnvironment env) //more code app.UseDefaultFiles(); app.UseStaticFiles(); I also add an index.html into a wwwroot folder ( also created into the root) You can see the modifications here: https://github.com/ignatandrei/InfoValutar/commit/4deb32528aee7b667f22a38c8e96899052cbfd4c Now I want to compile the…
-
Web site–Angular- part 40
Creating Angular app ng new InfovalutarWebAng Then customizing to add angular material ng add @angular/material and https://material.angular.io/guide/schematics#navigation-schematic ng generate @angular/material:nav banks Delete everyhing in app component ( without <div class=”content” role=”main”> add <app-banks></app-banks> ) See if it works. If yes,move the router outlet and footer to app-banks. Now,I want to solve the CD and to…
-
Exchange rates–what I have done in 37 hours–part 38
What I have create for now in 37 hours : A source control – https://github.com/ignatandrei/InfoValutar A plugin based software – you can use to load any kind of exchange rates,for anywhere,provided that you implement the interface – see implementation Tests for some of the code Deployment: An Azure WebAPP WebAPI deployment – https://infovalutar.azurewebsites.net/swagger/index.html A Docker…
-
Code Coverage–part 25
Install coverlet and report generator dotnet tool install coverlet.console dotnet tool install dotnet-reportgenerator-globaltool Then dotnet coverlet Infovalutar.sln –target “dotnet” –targetargs “test InfovalutarTest\InfovalutarTest.csproj –configuration release –no-build” –format opencover –exclude “[xunit*]*” dotnet reportgenerator “-reports:coverage.opencover.xml” “-targetdir:coveragereport” “-reporttypes:HTMLInline;HTMLSummary;Badges” And the result ?No assemblies have been covered. Updating all NuGet packages for the solution – including a collector…