Trying to get Redux app to display React elements (setup issue) - node.js

I'm trying to get async calls to work, but am stuck at a setup hurdle. I just read and replicated this async example, and then tried to copy some bits over into my app http://redux.js.org/docs/advanced/ExampleRedditAPI.html
My app won't display any errors and React elements do not get put onto the DOM and I'm only able to display my index.html...
If someone could check out the client folder where the react code sits that would be amazing (index.html is in views folder in root, bundle is in public/javascripts)
https://github.com/jaegerbombb/twitter-api-test
No idea what's going wrong and am wondering how I might be able to debug this type of issue in the future
Extra info:
I started out with everything working (a button saying show all and another saying hide all, which displayed a string) inside the client/twitter folder. My additions were inside the Tweets folder and appComponent/index files

Related

Serving JSON data from a Firebase website

I am setting up two websites under the same Firebase project for the first time and need some guidance.
The first website is a React app and it already works.
For the second site I created a folder named SecondSite. I also created a subfolder called public under SecondSite. At this point public only contains a static HTML file (index.html) that I am able to serve on the second web site. I did that following a couple of documents and tutorial that I found.
Now this is what I want to do next with my second site, I want it to serve JSON contents that I plan to get from the contents of the realtime database in my Firebase project. What is the minimum I need to do for that?
I believe I need to do some more setting up inside the SecondSite folder (to be able to connect to the DB), like installing some node.js modules, but I am not sure how to go.

the contents of my website is not showing

When I deployed my react website with three fiber, the contents such as my html would show at first before the content in the div start disappearing on the live. The js would load at first and then disappear. The model did not show at all.
Here is the live site:
https://xavi4075.github.io/portfolio/
It was fine before I compiled and exported onto github. I have no idea why this is happening
the development build is currently facing the same issues as the live one .The hosted code is on the gh-pages branch. The only thing that seems to be working is the background.
I did this from gui's response
however this was the response from the live site. It is working now in the development site with the fetch being portfolio/assets/airplane.fbx. how can I get rid of the second portfolio?
The only actionable item I can discern is your model not showing up. This is because the fetch for it is returning a 404 error. I'm unsure if this is the cause of everything else not loading correctly but if you open your console you'll see something like this:
Console error
I believe if you change the fetch from https://xavi4075.github.io/assets/airplane.fbx to https://xavi4075.github.io/portfolio/assets/airplane.fbx. Your model should show up since that is where your model lives in your files.

Refreshing Angular app breaks one component, but only on version hosted on Heroku

I am working on a personal project for my portfolio and I'm completely stuck.
I have an Angular 14 app I've been working on. The stack is PEAN. I currently have a live version of it hosted on Heroku. The issue I'm running into is that in my local development version of the app, everything works as intended, however on the live version on Heroku, If I refresh the page using f5 while on the main backlog page, it does not refresh, and instead shows a blank page with "[ ]" at the top of the page. Every other part of the app functions fine, and it does not fully crash when I run into this issue. If I type a different URL in and go to that page, it works again. If after doing so, I click a link that loads the crashed component, it will reload just fine. It appears that the component only breaks if I refresh the component with f5 (or clicking the refresh button on chrome).
I've been working on this for a long time and I think I've narrowed it down a bit. So far I've:
confirmed that my express server is serving my static HTML files from their folder correctly
added a catch all code block at the bottom of my express file to redirect to index.html
made sure that Heroku was actually executing my server.js file
removed potential offending portions of code, like auth/error interceptors and newly added Google Sign-in
I've also:
checked with various browsers/mobile browsers
checked for console errors (there are none)
checked network tab on refresh. (just shows a 304-OK response)
checked Heroku logs. No errors there either.
The issue can not be recreated locally, and it only happens on refresh of one component, the Backlog component.
If there is any more info I can add please let me know, I'm hoping this is a regularly encountered issue. I can't seem to find anything that specifically deals with my exact issue by searching. Any help is greatly appreciated.
update
The blank page with "[ ]" appears to be my database's response when hit without a user ID to check against, and return data. I've narrowed this down to an HTTP-INTERCEPTOR that injects the user ID into the headers, which the route that would use that info for the DB wouldn't have. This makes my DB return "[]".
The only thing I don't understand is that this happens only when hosted on heroku, and not locally.

How can I call node indexjs which is outside of /src folder in MERN app?

I am about to finish my first app(mern). I had a problem with getting data from mongoDB to my Autocomplete search-bar. I did find a tutorial(nodejs+express only tho) which shows how can I actually get data from database, I did follow it 1:1 but as I wrote before, its only nodejs+express. I did create it in folder 'routes' which is outside of /src folder and I dont know how can I call it out to check if it even works.
Here is how it looks like, I hope it works:
And this is the component I want to use the data which I've potentially got from database. Its hardcoded for now.
You would need to run your Express application locally then call your endpoint like you would any API.
It might be helpful if you move this in to its own folder
Project
--- Front end
--- Backend

React scripts access management with Express (React+Node+Express)

I’m new to React, and I have trouble with finding best solution for my app.
My current (Node.js+Express+Handlebars) app has one main menu with place where I render HTML received from AJAX request made after click on menu element. Then all actions inside this element are done by proper JS script. I wanted to improve it by using React, but I have problem with permissions management.
Currently, after authentication, handlebars receive list of files which user should load and render it as src in element. If user has access to only 5 of 20 modules, he can access only proper JS files. Also, he can’t access HTML he don’t has access to.
How to manage it in React? I want to have one interface for all users, but I don’t want to store logic for all components accessible for every user. I was thinking about something like AJAX loading components for React, but how to manage it?
Is it even possible? As I understand (maybe wrong), all React components are compiled from separated JSX files to one main.js, so is it possible to add separate files with other components?
I believe that the issue that you have encountered is a crucial step on the long stairway of making something great. The solution to your problem is the balance of all the present factors and consolidation of them to cooperate on a mutually beneficial basis. I hope that solves your problem

Resources