리액트와 노드합치기 강의 의문점입니다.
1. 지금까지 노드를 공부하면서
const path = require('path');
const http = require('http').createServer(app);
http.listen(8080,function(){
console.log('listening on 8080')
})
이런 코드는 처음봅니다.
path랑 http라는 라이브러리는 설치한적도 없고 app.listen(8080,~) 으로 서버를 열었는데
갑자기 마지막강의에서는 http.listen이 등장해서 뭐지 싶습니다.
path랑 http가 갑자기 왜 나온건가요 ?
2.
app.get('/',function(req,res){
res.sendFile(path.join(__dirname, 'react-project/build/index.html'))
})
에서 앞선 강의들에선 그냥
res.sendFile(__dirname + 'index.html') 이렇게 적었는데
왜 path.join이 붙고 , __dirname 다음에 +가 아닌 , 가 붙는지 궁금합니다.