【发布时间】:2017-06-07 05:58:49
【问题描述】:
我有一个使用npm 的环境。我的 package.json 如下:
`{
"name": "appname",
"version": "1.0.0",
"description": "",
"main": "entry.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.3.17",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-runtime": "^6.3.19",
"express": "^4.14.0"
},
"dependencies": {
"bootstrap": "^4.0.0-alpha.6",
"mongoose": "^4.7.7",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}
}`
我如何实际设置 Node.js + Express 服务器,这样我就可以启动它并转到 http://localhost:3000,还可以接收我所有的静态 html/css 文件,以及我的 React jsx 文件?
【问题讨论】:
-
您是否尝试过 Express.js 网站上的介绍性指南? expressjs.com/en/starter/hello-world.html
-
网上有 吨 的资源可以准确地解释如何做到这一点。
标签: javascript node.js reactjs