LoginSignup
10
7

More than 5 years have passed since last update.

Nodeでつくたwebappをherokuで公開

Last updated at Posted at 2015-07-06

Nodeでつくったwebappをherokuで公開する

Herokuにデプロイ

まず$ node app.jsで動かしていた場合はProcfileにweb:node app.jsと記入する

次に

package.json
"script":{
        "start":"node app.js"
         }

を追加する、これでnpm startで動く

アプリ内にURLがある場合はhttpを消す
   例:http://~~~~ ---> ~~~とする

そしたら

$ heroku create

$ git add .

$ git commit -m "comment"

$ git push origin master

$ git push heroku masterでherokuにデプロイする

$ heroku ps:scale web=1 *web=2にすると有料になるので注意

Addonsの追加

$ heroku addons:create [addonsname]

自分の場合はmongoDBをつかってるから

$ heroku addons:create mongolab

さらにPORTの追加をする

alt

でOK

HerokuとGithubを連携させる

alt

でできる。

10
7
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
10
7