我创建了一个基于 node.js express 和 react 的小项目。
我的项目结构很简单

我运行 node 作为服务器和所有反应代码 winthinclient文件夹。
我的节点package.json如下所示:
"scripts": {
"start": "concurrently \"npm run server\" \"npm run client\"",
"server": "node ./bin/www",
"client": "node start-client.js",
"lint:client": "(cd ./client && npm run lint)",
"lint:app": "eslint . --ext .js,.jsx --ignore-pattern 'client/*'",
"lint": "npm run lint:client && npm run lint:app",
"dev:client": "(cd ./client && npm start)",
"dev:app": "nodemon ./bin/www",
"build": "(cd ./client && npm run build)",
"test:client": "(cd ./client && CI=true npm test)",
"test:app": "jest --forceExit", …Run Code Online (Sandbox Code Playgroud)