Hosting Apple verification file with NextJS - reactjs

I'm using NextJS.
As per here, I need to host a file on my app.
Specifically, it needs to be hosted at:
https://app.blah.com/.well-known/apple-developer-merchantid-domain-association
What is the best way to serve this file from that folder? The URL has to be exactly as above.
When I try and put it in a folder at top level called .well-known, it doesn't work. I suspect because it's not being served when the app is actually built.
Conversely, localhost/static/apple-developer-merchantid-domain-association works fine if I put the file in there.
So, how can I do what I need to do here?

Anything in Next.js public folder will become accessible at root. So put the file in /public/.well-known/apple-developer-merchantid-domain-association and it will be accessible at yourdomain.com/.well-known/apple-developer-merchantid-domain-association.

Related

Nginx, Remove access to subdirectory like (Static/js/chunks.js) but main url should work

i want to remove access from url for subdirectory, i am using react js so someone try DDOS attach by access my static/js/chuks.js file please tell me how i can blockchain static file and other website remain works.

How do I add more than one Create React App (CRA) build to a SharePoint page?

I made the shift from Vue over to React and I enjoy using the CRA tool to make interfaces on SharePoint. My normal methodology involves building the app and linking the build index.html file to a SharePoint Content Editor Web Part (CEWP).
I recently needed to have two CRA builds on the same page and I am running into the issue where control of the DOM by one build overwrites the content of the other build on the page.
It is now my understanding that multiple CRAs cannot exist on the same page. I do not want to eject my apps. In my research, it seems that webpack is assigning this["jsonpFunction...] to both apps. One suggestion I read involved finding and replacing all instances of this in one of the apps and changing it to "window.jsonpFunction...". I could not get that working either.
I want to continue using CRA and linking the index.html of the builds to different web parts on the same page.
Any suggestions appreciated.
Very Respectfully,
I solved my SharePoint on-premise issue with multiple React builds working in separate web parts by doing the following.
In package.json ensure the "name" field is unique. Also, ensure you have a "homepage" variable set to the location you intend to copy the build index.html file.
In index.js set the document.getElementById to a unique name not used by other React projects that will exist on the same page.
In index.html make sure the name used for the root div is identical to the one used in step 2 above.
In the manifest.json, provide a short name and name for your App. This step doesn't seem mandatory but I did it for consistency in my projects.
Now you can build and copy to SharePoint. I use Content Editor web parts with each pointing to the applicable index.html file for the app. Works great!

How can I build a Go app with a ReactJS GUI in a single binary?

I would like to develop a Go application with a ReactJS "GUI".
My point is to launch a single binary "app" that launch a server at "localhost:someport" serving a ReactJS app.
I would like my actions in the ReactApp to be taken into account in the Go-side app.
I can do a Websocket-based ReactJS-Go application but I'd like everything to be bundled into a single binary.
I've followed this : https://medium.com/#esslamben/serving-static-sites-with-go-55bfc1ae4495.
This tutorial helped me to serve static files (a React App) with a single file.
But, I don't know how to continue to satisfy my wishes.
The thing I would like to achieve is the behavior like the old "RethinkDB".
When you run "rethinkdb.exe" in command line, it notifies a administration panel is running on 8080 port.
Navigating through localhost:8080 enables to administrate the database with a web-based GUI.
Does someone have advice to help me to obtain such a behavior?
You cant make binary for your React code , it should be copied
Your react built code (I assume static ) and put it in a specific path
Use Go http FileServer handler to serve the app as static one.
This might work or may not , I am not sure what are the bindings which is necessary should alos be copied. (your node modules and additional libraries you use it in your package.json)
Put your *.js binary data inside an HTTP handler to serve the client.
Store your js file as an []byte inside your application.

Can I have a config.json file to hand to my clients so they can change values on their website?

Using react-app and webpack, I was wondering if it's possible to bundle a config.json file such that you can access it after the site builds and be able to change values within it and have that be reflected on the website. This is mainly so that I can have values in my config.json file like "header__1" or "about__description" in my config.json file and hand them over to my clients so that they may change values themselves w/o having to consult me.
Welcome to stackoverflow Shaun,
since you're writing a web application with react and it is all about Javascript, you can't work with files like you can with desktop clients. Neither should you (read more here).
If you want your web clients to be modifiable by the customer you should add something like a config page to your app. The values that change should then be stored in the localStorage of the browser or something similar.
EDIT: Of cause a config file could be loaded from an external source. But then you have to differ between users and their individual configurations (which might be not what you want). Files bundled with webpack can't be edited (permanently) on the users side.

I copy the files that the gatsby build gives to ampps/www/my-site but the links not work

I create a new site using the gatsby-cli. Then I just build the site, then, all the content that is inside the build I copied to my AMPPS/www/my-site folder. When I access to the site, the index works correctly but when I click on a route to go to another route I got the following error: The requested URL /page-2/ was not found on this server..
I understood that gatsby will generate an static HTML site, and the production server where I need to place the build only accepts an static HTMl site. So is there a way to achieve a truly server side rendering with gatsby?
Thanks in advance.
The solution is quite simple:
If apache serves ampps/www/my-site as http://localhost/my-site you need to use path-prefix, by default gatsby assume it will be hosted at root of domain.
To enable this features, we just need to use the following documentation: https://www.gatsbyjs.org/docs/path-prefix/

Resources