sudo apt-get update
- node 16을 설치하는 방법
1) sudo apt install -y curl
2) curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
3) sudo apt install -y nodejs
sudo a
pt install git
1) sudo npm install -g n
2) sudo n v14
git clone "깃허브 프로젝트 주소"
cd test : test 디렉토리로 이동하는 명령이다.
sudo npm install
npm run build
sudo npm install
import express from "express";
import path from "path";
const app = express();
// 서버에서 배포시에 PORT를 80으로 한다.
const PORT = 80;
const __dirname = path.resolve();
app.use(express.static(path.join(__dirname, "../front/build")));
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, "../front/build", "index.html"));
});
const server = app.listen(PORT, () => {
console.log(`Start Server Port is : ${PORT}`);
});
app.get("*", function (req, res) {
res.sendFile(path.join(__dirname, "../front/build", "index.html"));
});
sudo npm install pm2 -g
sudo pm2 start index.js