After create-react-app installation, do I still need to install express?

after create-react-app is installed, I want to use Express. I see that express already exists under node_modulues, but I introduce an error

.

neither of the two quotations is correct

import logo from "./logo.svg";
import "./App.css";
import $ from "jquery";
//import Express from "express"      

//const Express = require("express");   
TypeError: http.ServerResponse is undefined
./node_modules/express/lib/response.js/<
E:/react08/react-app/node_modules/express/lib/response.js:42

  39 |  * @public
  40 |  */
  41 | 
> 42 | var res = Object.create(http.ServerResponse.prototype)
  43 | 
  44 | /**
  45 |  * Module exports.

do not understand, ask for advice!


  1. print the express coming in from require
  2. express runs with node, while cra runs with webpack-server
  3. check for express in pakage.json

finally, it is recommended to put the express-related back-end code in a separate folder


express is on the server side. You can't quote it in the front end. Is it in the wrong place?


Why do you need to use express?

if you do need express, your application should run on (or at least partly on) the server.
then you need to modify the webpack build configuration

module.exports = {
  target: 'node'
};

for more information: https://webpack.js.org/concep.

Menu