0
這是一個服務器的配置代碼:如何在沒有index.html的情況下在'/'上進行快遞服務?
const app = new WebpackDevServer(compiler, {
contentBase: '/public/',
proxy: {'/graphql': `http://localhost:${GRAPHQL_PORT}`},
publicPath: '/js/',
stats: {colors: true},
});
// Serve static resources
app.use('/', express.static(path.resolve(__dirname, 'public')));
,當應用程序運行時,它是在localhost:3000/index.html的,我想渲染localhost上的應用程序:3000 /。我怎樣才能做到這一點?我有這個問題,因爲如果沒有錯誤,反應路由器不要在我的代碼工作:
<BrowserRouter>
<Route exact path='/' component={App}/>
</BrowserRouter>
,並在localhost:3000 /這是我的輸出: