problem while adding service worker for pwa angular 7 - angular7

I'm working on a Angular app where I need to integrate pwa for desktop. My app already consist of push notification with fcm and I found this library Service worker which is used for pwa as well. My application has several modules in it for which there is a corresponding server side module that interact with through the API calls.
Can I use direct server url in my project in start url in manifest file?
I tried with my local setup but I got below error
My project angular.json file structure follows
Fromm root -> src -> I have
index.html
sw-app.js
sw.js
In sw-app.js
In sw.js
In index.html I added
<script type="text/javascript" src="sw-app.js"></script>
In console of service worker
In manifest file
Why I got bad http response code with 404?.. Please help me out

Here we should also load sw.js file in angular.json file.
This resolved my problem.

Related

I released my Dart Web app but after deploying it bootstrap all.css was not found

I used webdev to build my Dart Angular web application with the following command:
webdev build -r
Everything works besides bootstrap, the browser gives error 404 not found for all.css file.
I checked on the build result and all.css does not exists, just the all.scss file.
Should web dev convert this sass file to regular css when it's releasing the application.
I have components that use scss files and I have no issue with them (I know they are compiled to my main.js file)
Any help I'd be thankful.
For now I logged into my local test and manually copied the resulting all.css with my chrome source into my build but I don't think I should do this every time I do a new build.

Mimicking build_runner serve on a nodeJs server

With the expiration of Dartium that happened just a few days ago, I felt compelled to migrate from dart 1.24.3 to Dart2, even though it is still in dev.
I have although hit a few walls doing so, one of them being related to the architecture of my apps.
I run a nodeJs server, which also acts as a webserver with client side dart.
The problem that I experience with the new dart SDK is that in order for the .dart files to be read in Chrome, they must be served using webdev serve or build_runner serve.
Obviously, these 2 commands act as the file server, which is not what I want since I'm using a nodeJS server.
By using build_runner watch I think I am enabling the build and watch of the .dart files into .dart.js inside of the following directory :
.dart_tool/build/generated//lib
I am also able to serve them from my nodeJS server. What remains is the package directory, I can't seem to find where pub serves gets the following package files:
/packages/$sdk/dev_compiler/amd/require.js
/packages/$sdk/dev_compiler/amd/dart_sdk.js
Does anyone know what build_runner serve does to include them?
Thank you,
There are 2 options for using a different server during development.
Run build_runner serve on a different port and proxy the requests to it from your other server. This has the benefit of delaying requests while a build is ongoing so you don't get an inconsistent set of assets.
Run build_runner watch --output web:build and use the created build/ directory to serve files from. This will include a build/packages directory that has these files in it.
These files are served from the lib directory of the dart sdk itself.
Note that there is another option, which is to use the -o option from build_runner. This will create a merged directory with source and generated files, which you can serve directly without relying on any internal file layout.

IT Hit WebDAV Sample App not running with tomcat

I have downloaded the sample app [ITHitWebDAVServerLibJava.tar.gz] trying to understand how this IT Hit Webdav work.
I started the demo app with Tomcat 8, running on JDK 1.8. From the tomcat console / log, it seems everything just fine, however when I access the main page, it doesn't list out the sample folders & files as how it suppose to (referring to the online demo).
screen : main page is render without listing out the folders & files
I downloaded the sample app and unzip it, without changing the folder structure of it. I have just edited the WEB-INF\web.xml so that it point to the correct trial license file. Please advise if I have missed out some configuration? Should I move out certain files from the WEB-INF folder? Is there any step by step setup guide this demo?
screen : unzipped sample app folder without changing the folder structure
Also, I have downloaded the trial version of AJAX library as well [ITHitWebDAVAJAXLibraryTrial.tar.gz], please advise how should I put this library into the main sample app? As in I should put this library files under which folder of the main sample app?
Please advise.
The default HTML page supplied with IT Hit WebDAV Server Library for Java sample servers use IT Hit WebDAV Ajax Library to list and browse WebDAV server content as well as to open documents for editing.
You can install IT Hit WebDAV Ajax Library from NPM using NPM command-line tool.
Install the Node.js, it installs NPM command-line tool.
Navigate to '\sample_folder\WEB-INF\wwwroot\' folder.
Execute:
npm install webdav.client
This will download IT Hit WebDAV Ajax Library library into the wwwroot folder.

Corodva serve command just reset the app erasing all my changes

I use the command cordova serve to test the app in browser. But when I issue the command, I find all the code changes I made to the app has been disappeared include newly added js files etc. The app just got a complete reset. How can I avoid this and still use cordova serve command to test in browser? Thanks.
I got the issue resolved. It took sometime to figure out what is happening under the hood. As I was making changes directly in platform IOS directory, the cordova prepare or serve statement just replaces the code from the parent www folder.
To conclude, I have to make changes in root www folder and then issue the prepare/serve command that copies the code to the platform to test it out.

phonegap-app-developer does not work with cordova-plugin-wkwebview-engine

can anyone run phonegap-app-developer with cordova-plugin-wkwebview-engine?
this is my environment:
phonegap: 6.3.0
cordova-plugin-wkwebview-engine: 1.0.3
cordova-labs-local-webserver: from https://git-wip-us.apache.org/repos/asf/cordova-plugins.git#master:local-webserver
I use webpack dev server to download assets, and I think I configure it to return CORS header already (Access-Control-Allow-Origin: *).
under such a circumstance, I try to run phonegap-app-developer with cordova-plugin-wkwebview-engine. for the first time with this instruction. but got following error, which seems to described in here.
2016-08-16 16:50:01.026 PhoneGap[456:87484] Copying Cordova Assets
2016-08-16 16:50:01.026 PhoneGap[456:87484] Found /www folder. Will copy Cordova assets to it.
Received an unexpected URL from the web process: 'file:///var/mobile/Containers/Data/Application/...snip.../Library/NoCloud/phonegapdevapp/www/index.html'
Received an invalid message "WebPageProxy.DecidePolicyForNavigationAction" from the web process.
then I find this article, do the same with phonegap command (instead of ionic). as a result, above error is gone. but still phonegap-app-developer shows white screen.
official repository still does not use wkwebview plugin, so I doubt it does not work with developer app.

Resources