웹 애플리케이션 배치 모델로 사용되는 여러 프로그래밍 언어를 지원하는 클라우드 PaaS 플랫폼
heroku에서 repository 생성
github에서 repository 생성
내 local에 git clone
node.js 설치 (설치가 안된 상태라면)
heroku에서 git repository 연동
npm init
웹 서버 설치
npm install express --save
express는 웹 서버를 실행시켜주는 모듈
예시 파일 생성
// package.json
"scripts": {
"start": "node app.js", // 추가
"test": "echo \"Error: no test specified\" && exit 1"
},
App.js 생성
const express = require('express')
const app = express();
const port = process.env.PORT || 3000;
app.get('/', (req, res) => res.send('Hello, Nodejs!'))
app.listen(port, () => console.log('Example app listening on port 3000'));
npm start
heroku CLI 설치 (설치가 안되어 있다면)
heroku version 확인
heroku --version
heroku login
heroku login
heroku list
heroku list
heroku apps
heroku 반영
heroku git:remote -a <연동할 앱>
heroku에 반영
git push heroku master
// heroku로 바로 반영 (Local -> heroku)git push
// github에 반영github -> heroku로 deploy 방법
Deploy Branch
적용Enable Automatic Deploys
heroku log 확인
heroku logs
1. heroku app을 생성
2. github.com 에 repository 생성
3. heroku app과 연동
deploy
- manual (수동)
- automatic (자동)