heroku で静的コンテンツを作成する手順メモ version 1
年のせいもあって脳が7年前くらいから右脳の調子が悪いのでログを残します。
プロジェクトの準備
% mkdir testapp && cd _ % cat package.json { "name": "testapp", "version": "0.0.1", "private": true, "engines": { "node": "0.10.26" } }
% npm install coffee-script serve-static connect --save
% cat app.coffee connect = require 'connect' serveStatic = require 'serve-static' port = process.env.PORT or 3000 app = do connect app.use serveStatic 'public/', {'index': ['index.html']} app.listen port console.log 'Server listening on port %s', port
% cat public/index.html <!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <title>title</title> <link rel="stylesheet" href="style.css"> <script src="script.js"></script> </head> <body> hello, World!! </body> </html>
% cat bin/www coffee app.coffee % chmod +x bin/www
% cat Procfile web: bin/www
% cat .gitignore node_modules/
% cat .buildpacks https://github.com/heroku/heroku-buildpack-nodejs.git
deploy heroku
% heroku create % heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git % git push heroku master % heroku open
問題が起きたら
% heroku --help % heroku logs