Created
July 8, 2019 13:44
-
-
Save cto-4piens/ceaef3a43dbab08a634984612cf6d030 to your computer and use it in GitHub Desktop.
[express로 build완료한 react app 서빙하기] #express #react-app #build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//백엔드와 프론트엔드 폴더가 완전히 분리되어 있는 상태이다. | |
const express = require('express'); | |
const path = require('path'); | |
const app = express(); | |
const staticPath = path.join(__dirname, '../frontend/build') | |
console.log(staticPath) | |
app.use(express.static(staticPath)); | |
app.get('/', function(req, res) { | |
res.sendFile(path.join(__dirname, '../frontend/build', 'index.html')); | |
}) | |
app.listen(8000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment