Google chrome app writing files to the app folder - filesystems

https://developer.chrome.com/extensions/xhr documents access to
a file in the source code by a user of an installed chrome app.
ie xhr.open("GET", chrome.extension.getURL('/config_resources/config.json')
It works for the app I'm developing.
Where is the root folder for such "local" urls?
Can a user of my chrome app save a file to this folder? How?

The extension folder is not writable or accessible to the user. If it is acceptable for the files to be not accessible outside your app, you can write files using the sandboxed filesystem api.
You can also access the files in your package using fetch or
chrome.runtime.getPackageDirectoryEntry

Related

App Service web app showing file structure instead of actual web apge

Today i've deployed my client react app to Azure App Service. The problem is, that instead of displaying site im interested in, it returns structure of wwwroot. Even if I change directory to /src/App.js it return code of the App. What is the problem?
When you run a node application on Windows Azure Web Apps, IIS is used as the webserver together with iisnode and most likely some configuration is wrong so IIS doesn't know what to start. I'd suggest to let Azure handle the creation of the web.config and you don't touch it unless you know what you're doing:
Create a file .deployment with the following content
[config]
SCM_DO_BUILD_DURING_DEPLOYMENT = true
Put the .deployment file as well as the content of your React app (don't include web.config, you also don't have to include the node_modules folder, Azure will handle this as SCM_DO_BUILD_DURING_DEPLOYMENT is set to true) into an upload.zip file.
Delete the content of /wwwroot in Azure
Run az webapp deployment source config-zip -g <ResourceGroupName> -n <AppServiceName> --src upload.zip
A new web.config should get created which should contain a handler for server.js which will be the file to be served by Node.js.
This is solved. Thanks to #azium
The only thing i needed to do is run
npm run build
in local before deployment

Config File in ReactJS application

I have developed a reactjs application and have hosted in azure cloud. Now we want to implement the CI/CD process through Azure pipelines. I am quiet new in both the platforms. Need to know the process.
Currently, I have one file index.js where I have used the axios and have set the base URL to connect to the server. All my web services in different components class access this axios settings for accessing data from server. We have four environments, DEV,SIT, UAT and PROD. So for now I use to manually change the axios base URL and create the build and zip it and host it to the respective environments.
I need to understand for CI/CD what steps should I take. Most of the google finding suggested to have a config file. But how I can change my current implementation is a big challenge for me. For example my axios base URL, how it will take the value from the config file, or where I should create the config file, because when I create the build, all the js files are minified into one file and are put in the static folder. Apart from the static folder, the app icons and the files in the public folder of the project directory are listed (in the build folder). So shall I include a config file in the public folder or something else.
There are also webpack.config.dev.js and webpack.config.prod.js in the config folder of the project directory. Will it help. Because the requirement is first through Azure pipelines, the code will go to the DEV environment, then from DEV to SIT and from SIT to UAT and then to PROD. So subequently my axios Base URL should also change accordingly.
Can anyone suggest anything?
I'm not sure I fully understand your question but you could create a json file and put your config data in there, i.e. server_config.json. It would not be minified as it is not a js file. Then you will need to read the json in your code to get all the settings. Your CI/CD can also read this fille should it need to.
You should also make sure that the json config file is ignored from version control so that each environment has to have its own file.

How do I access my system code that is in the app engine through the cloud shell?

I have a system on App Engine, but I need to upload an HTML file in the code. How do I access my system folder through Cloud Shell and upload the HTML file?
You can not upload a single file to Google App Engine. When you deploy to GAE, the process syncs your local files (working directory) with the remote files (remote directory). All changes made on the working directory will be reflected on the remote directory after deployment.
As marian suggest you will need to try deploying your application again including all the files you want to be uploaded(such the html file you mentioned).
You can check this document [1]
[1] https://cloud.google.com/code/docs/intellij/deploy-flex

Can I deploy react.js web app to a share hosting?

I am wondering if it is possible to deploy react.js web app that I've built to a share hosting site that does not have node.js installed?
I use webpack to build the application and it creates normal html, js, css file. I uploaded the static folder that includes all those html, js(bundle.js) and css files, but when I request the site, the server reply with 404 bundle.js not found response.
Use npm run build, you should get a folder with the index html file inside that will run your app. Try this with xampp first before you actually deploy to your server.
Here is everything step by step
npm run build
or
yarn run build
it will generate a build folder that looks like this:
Copy everything and move it to the htdocs in xampp or ftp upload the directory to the public_html file in your hosting
Yes you sure can put react on a shared hosting provider.
Seeing as you're getting a 404 error (not found), you are probably referencing your react file/bundle incorrectly. It might not even be named bundle.js if you're using a boilerplate to create your application.
Can you give more information? What does your index.html file look like? What does your directory structure look like? If you are able to post these files I can tell you what the issue is.
Update:
The answer below should be accepted. (Although this would assume that you have the ability to make a build which you have not verified or not.)
Make a build using the build command through whatever boilerplate you used. Deploy those files on your shared hosting server. Make sure that index.html is at the root of where your server is expecting the root to be and your app should be live.
For deploying a react app on a shared hosting you need to create a production build. Production build is a pack of all your react code and its dependencies.
in most shared hosting we put our site/app inside a public_html directory so if we hit www.yourdomain.com it serves the code from public_html directory.
so if your react app is ready to go, edit your package.json file add a new key value:
"homepage":"http://yourdomain.com"
then create a build using following command:
npm run build
after running the command you will see a new directory named build in your app root. It will contain js and css for the app and a index.html file. You need to upload all the content inside build directory to public_html directory, and that's all, go to your domain and your app will be working just fine.

How to change the file upload folder in apache tomcat?

Tomcat 6.29 creates a folder under temp folder in apache tomcat, and when I uploaded a file with the path req.getSession().getServletContext() + specified folder but when the application is redeployed another application folder is again created so the previously uploaded files stay at the older deployed application. I want to upload files under webapp folder/app_name but at that time I take the specified doesn't exist. I wonder if it is possible to upload and retrieve the files under the webapp/app_name.
Note: application is developed with spring+hibernate and deployed with maven.
Yes. Just use a relative path in your file handler code. Go up with ../../.. etc. Or you can make a direct server request against the old app from within your handler - servlet to servlet, for example.

Resources