DongyoungKwon

Modify for distribution using heroku

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