http://localhost:8080/
폴더내에 public/main.html 은 잘 접속이됩니다.
http://localhost:8080/react
폴더내에 react-project/build/index.html는 단독으로 설정할땐 잘되는데
위에주소로하니 흰색 빈페이지만 나옵니다. package.json에 설정을 해줬는데도 말이죠
그래서 혹시나. react-project/build/test.html을 만들어서
http://localhost:8080/react/test.html은 접속이 잘되구
http://localhost:8080/react/index.html은 여전히빈화면인데 뭐가 문제일까요?
const express = require('express');
const path = require('path');
const app = express();
const http = require('http').createServer(app);
http.listen(8080, function () {
console.log('listening on 8080')
});
app.use('/',express.static(path.join(__dirname, 'public')));
app.use('/react',express.static(path.join(__dirname, 'react-project/build')));
app.get('/', function (요청, 응답) {
응답.sendFile(path.join(__dirname, 'public/main.html'));
});
app.get('/react', function (요청, 응답) {
응답.sendFile(path.join(__dirname, 'react-project/build/index.html'));
});
{
"homepage": "/react",
"name": "react-project",
"version": "0.1.0",
"private": true,
.........