express.js + reactJs app重新加载问题

时间:2017-07-11 21:06:56

标签: node.js reactjs express

我正在开发react和express.js应用程序。前端使用反应路由器和服务器路由器其快速路由器。 在制作中,重新加载显示can not Get /exampleRoute/..

以下是index.js的{​​{1}}。

express

应用程序正常加载,但每次刷新都不会引发const isDev = process.env.NODE_ENV !== 'production'; const bodyParser = require('body-parser'); const cookieParser = require('cookie-parser'); const cors = require('cors'); const express = require('express'); const logger = require('morgan'); const fs = require('fs'); const port = 8771; const path= require('path'); const API = require('./api'); const app = express(); app.use(cors()); app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.use(cookieParser()); app.use('/index.html',function(req,res){ res.end(); }); const apiBase = '/api/'; const accounts = require('./routes/accounts'); const auth = require('./routes/auth'); app.use(apiBase + 'accounts', accounts); app.use(apiBase + 'auth', auth); app.use(apiBase + 'conversation', conversation); app.use('/healthcheck', function(req, res) { res.json({status: 'UP'}); }); app.use('/', express.static(path.join(__dirname + '/public'))); console.log(`Server is running on, open http://localhost:${port} to test!`); server.listen(port); 错误。任何人都可以建议我快递服务器有什么问题。

0 个答案:

没有答案