herokuã«node.js & Expressããããã¤ããã
herokuä¸ã§node.js & Expressãåãããã¨ãã®ã¡ã¢ã
ããããããherokuã®ã¢ããªãローカルにcloneãã¦ããã
- expressã®ã¤ã³ã¹ãã¼ã«
- ããã¸ã§ã¯ãä½æ
- Procfileä½æ
- ãããã¤
expressã®ã¤ã³ã¹ãã¼ã«
npmã使ã£ã¦ãexpressãã¤ã³ã¹ãã¼ã«ããã
npm install express
ãã®ã³ãã³ãã§ãã«ã¬ã³ããã£ã¬ã¯ããªã«node_moduleã¨ãããã£ã¬ã¯ããªãä½æãããã
ããã¸ã§ã¯ãä½æ
expressã³ãã³ãã§ããã¸ã§ã¯ãã®ã¹ã±ã«ãã³ãä½æããã
./node_modules/.bin/express destination is not empty, continue? yes create : . create : ./package.json create : ./app.js create : ./public/javascripts create : ./public/images create : ./public create : ./public/stylesheets create : ./public/stylesheets/style.css create : ./routes create : ./routes/index.js create : ./routes/user.js create : ./views create : ./views/layout.jade create : ./views/index.jade install dependencies: $ cd . && npm install run the app: $ node app
Procfileä½æ
package.jsonã¨åããã£ã¬ã¯ããªã«Procfileãä½æããã
ã¡ã¤ã³ãã¡ã¤ã«ã®app.jsãæå®ãã¦ããã
web: node app.js
ãããã¤
ããã¾ã§ã§ããã¼ã«ã«ã®è¨å®ãå®äºããã®ã§ãã³ããããã¦herokuã«ããã·ã¥ããã
git add . git commit -m "setup node.js" git push heroku master
ããã·ã¥ã§ããããheroku openã³ãã³ãã§ãã©ã¦ã¶ã«è¡¨ç¤ºãããã