0

Hi guys I am using a typical react folder structure;

- React Blog
  - public
  - react-blog-end
    - src
      server.js
  - src
  ...

Some background information: the src folder obviously runs on port 3000 (react convention). My server.js file is a node.js script. It runs on port 8000. The code is here:

const express = require('express');
const app = express();


app.get('/test', (req, res)=> {
    res.send("Hello");
})


app.listen(8000, () => console.log("Listening on port 8000"));


It is extremely simple. I just got started to work on the back-end. When run the server.js script in the browser, it shows:

GEThttp://localhost:8000/test
[HTTP/1.1 404 Not Found 7ms]

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“default-src”). injectGlobalHook.js:513:49
Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:8000/favicon.ico (“default-src”).

Does anyone knows what is the problem and how to solve it? Thanks!

Rieder
  • 1,125
  • 1
  • 11
  • 18
  • I posted an answer before but I think it was unrelated. Can you clarify what command you are running to start BOTH your server AND client? I'm pretty sure you just didn't start your backend server. On that note, your "typical react folder structure" is not that typical if it is like your posted. You should create 2 separate projects for both your client and server, then start both of them. – stvn Aug 28 '20 at 13:50
  • @stvn Hi! So the command I run is **node server.js**. Just started to learn the back end part... Really want to get some advices – Rieder Aug 28 '20 at 23:13

0 Answers0