javascriptjavareactjsspring-bootmustache

Spring boot error : Loading module from “http://localhost:8080/index.js” was blocked because of a disallowed MIME type (“application/json”)


I followed a tutorial, I copied and pasted the code, but it's not working!

The goal is to use react and spring-boot together to send web pages to the user (I think). So when they go to a api pathway, it should just load up the index.js.

It worked with just basic html, when I tried to follow the part for javascript and react it stopped working.

What happens:

when I go to localhost:8080/react (this mapping should load a mustache file, index.js) I just get a blank page, pressing f12 (open browser console) showed me this error: Loading module from “http://localhost:8080/index.js” was blocked because of a disallowed MIME type (“application/json”).

when i click on the link in the image above i get a 404 not found error.

when I go to localhost:8080/ I get the html mustache file as expected.

console: enter image description here

code:

The tutorial made me locally download node.js, then it made me download plugins (parcel and react-dom), and then gave me 4 small javascript files to make.

Here is the github link (.idea, .mvn, node and node_modules are no there because they are too big ) :

https://github.com/S1coding/halp

File directory:

enter image description here


Solution

  • Well, I found out that the tutorial was just dead wrong. The way it teaches just doesn't work? So I didn't do anything wrong, the tutorial was just wrong.