DongyoungKwon

Modify for distribution using heroku

......@@ -3,9 +3,9 @@ import styled from 'styled-components'
import stringSimilarity from 'string-similarity'
const StyledTeleprompter = styled.div`
font-size: 9rem;
font-size: 6rem;
width: 100%;
height: 56rem;
height: 35rem;
scroll-behavior: smooth;
overflow: auto;
display: block;
......
{
"name": "teleprompter-sst",
"name": "teleprompter-stt",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client",
"client": "cd client && yarn start",
"server": "nodemon server.js",
"dev": "concurrently --kill-others-on-fail \"yarn server\" \"yarn client\""
......@@ -21,5 +22,9 @@
"devDependencies": {
"concurrently": "^5.3.0",
"nodemon": "^2.0.6"
},
"engines": {
"node": "12.18.3",
"npm": "6.14.6"
}
}
......
const fs = require('fs');
const path = require("path");
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
......@@ -19,4 +20,10 @@ app.post('/api/:script', (req, res) => {
scriptReceived = req.body.script;
});
app.use(express.static(path.join(__dirname, './client/build'))); // μ •μ νŒŒμΌλ‘œ λ°”κΏ”μ§„ React[front-end]λ₯Ό Express μ„œλ²„λ‘œ μ‚¬μš©ν•˜μ—¬ 기쑴의 2개의 μ„œλ²„λ‘œ μš΄μ˜ν•˜λŠ” 것을 ν•˜λ‚˜μ˜ μ„œλ²„λ‘œ μ‚¬μš©ν•  수 μžˆλ„λ‘ ν•΄μ€Œ
app.get('*', (req, res, next)=>{
res.sendFile(path.join(__dirname, "./client/build", "index.html"));
});
app.listen(port, () => console.log(`Listening on port ${port}`));
\ No newline at end of file
......