简体   繁体   English

如何运行节点js并做出反应?

[英]How to run node js and react?

My question is simple How to run a server node js and a react app in same time?我的问题很简单如何同时运行服务器节点 js 和 React 应用程序? My package.json我的 package.json

 { "name": "mon-app", "version": "0.1.0", "private": true, "dependencies": { "express": "^4.17.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-scripts": "0.9.5" }, "devDependencies": { "concurrently": "^2.2.0" }, "scripts": { "start": "concurrently \\"node server.js\\" \\"react-scripts start\\"", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }

I use concurrently Moreover npm start runs of course the dev server Thanks for your help :)我同时使用而且 npm start 当然运行开发服务器谢谢你的帮助 :)

you can try doing something like this:你可以尝试做这样的事情:

 { "name": "mon-app", "version": "0.1.0", "private": true, "dependencies": { "express": "^4.17.1", "react": "^16.14.0", "react-dom": "^16.14.0", "react-scripts": "0.9.5" }, "devDependencies": { "concurrently": "^2.2.0" }, "scripts": { "server": "node server.js", "client": "react-scripts start", "start": "concurrently \\"npm run server\\" \\"npm run client\\"", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }

does that solve your problem?这能解决你的问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM