0
0

More than 3 years have passed since last update.

herokuでアプリの作り方

Last updated at Posted at 2021-06-21

(リポジトリの作成は割愛)

1. Herokuにログインする

$heroku login

2. アプリケーションを作成する

$heroku create <アプリケーション名>
HerokuのサイトからGUIでも作成できる。

3. 設定からdb情報を設定する

https://dashboard.heroku.com/apps/<アプリケーション名>/settings

[Reveal Config Var]ボタンから、MongoDBの情報を設定する。
スクリーンショット 2021-06-21 午後7.02.05.png

4. Package.JSONを書き換える

トップに下記(自分の環境)を追記する。
"engine" : {
"node":"14.17.0"
},

スクリーンショット 2021-06-21 午後7.06.17.png

node --versionで念の為、自分の環境を確認しよう。

5. PORTを書き換える

const PORT = process.env.PORT || 3000;

6. プッシュする

git add -A
git commit -m "Ready for Heroku"
git push origin main && git push heroku main

https://git.heroku.com/<アプリケーション名>.git

エラー['heroku' does not appear to be a git repository]になったら、

git remote add heroku https://git.heroku.com/アプリケーション名.gitとする

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0