Skip to content

Instantly share code, notes, and snippets.

@evenchange4
Created September 23, 2012 21:55
Show Gist options
  • Save evenchange4/3773179 to your computer and use it in GitHub Desktop.
Save evenchange4/3773179 to your computer and use it in GitHub Desktop.

Revisions

  1. evenchange4 revised this gist Sep 24, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion step.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Deploy a Express.js project on Heroku
    # Deploy a [Express.js project](http://myfirstexpress.herokuapp.com/) on Heroku
    Step by step from command line
    by Michael Hsu
    ## Quick start
  2. evenchange4 revised this gist Sep 23, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions step.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ by Michael Hsu
    ```
    $ express myfirstexpress && cd myfirstexpress
    ```
    ### Declare dependencies with NPM
    ### Declare dependencies with NPM `/package.json`
    ```
    # /package.json
    {
    @@ -31,7 +31,7 @@ $ express myfirstexpress && cd myfirstexpress
    $ sudo npm install -l
    ````
    ### Declare process types with Procfile
    ### Declare process types with `Procfile`
    ```
    # create '/Procfile'
    web: node app.js
  3. evenchange4 revised this gist Sep 23, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion step.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Deploy a Node.js project on Heroku
    # Deploy a Express.js project on Heroku
    Step by step from command line
    by Michael Hsu
    ## Quick start
  4. evenchange4 revised this gist Sep 23, 2012. No changes.
  5. evenchange4 revised this gist Sep 23, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion step.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    Step by step from command line
    by Michael Hsu
    ## Quick start
    ### Create a Node.js web framework 'express'
    ### Create a [Node.js](http://nodejs.org/) web framework '[express](http://expressjs.com/)'
    ```
    $ express myfirstexpress && cd myfirstexpress
    ```
  6. evenchange4 revised this gist Sep 23, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion step.md
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,7 @@ web.1: up for 10s
    # Open
    ```
    $ heroku open
    [http://myfirstexpress.herokuapp.com/](http://myfirstexpress.herokuapp.com/)
    http://myfirstexpress.herokuapp.com/
    ```
    ## Reference
    [Getting Started with Node.js on Heroku](https://devcenter.heroku.com/articles/nodejs#listing-and-scaling-dynos)
  7. evenchange4 revised this gist Sep 23, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion step.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,8 @@ web.1: up for 10s
    ```
    # Open
    ```
    $ [heroku open](http://myfirstexpress.herokuapp.com/)
    $ heroku open
    [http://myfirstexpress.herokuapp.com/](http://myfirstexpress.herokuapp.com/)
    ```
    ## Reference
    [Getting Started with Node.js on Heroku](https://devcenter.heroku.com/articles/nodejs#listing-and-scaling-dynos)
  8. evenchange4 revised this gist Sep 23, 2012. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions step.md
    Original file line number Diff line number Diff line change
    @@ -67,8 +67,7 @@ web.1: up for 10s
    ```
    # Open
    ```
    $ heroku open
    http://myfirstexpress.herokuapp.com/
    $ [heroku open](http://myfirstexpress.herokuapp.com/)
    ```
    ## Reference
    [Getting Started with Node.js on Heroku](https://devcenter.heroku.com/articles/nodejs#listing-and-scaling-dynos)
  9. evenchange4 revised this gist Sep 23, 2012. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion step.md
    Original file line number Diff line number Diff line change
    @@ -65,5 +65,10 @@ $ heroku ps
    === web: `node app.js`
    web.1: up for 10s
    ```
    # Open
    ```
    $ heroku open
    http://myfirstexpress.herokuapp.com/
    ```
    ## Reference
    [Getting Started with Node.js on Heroku](https://devcenter.heroku.com/articles/nodejs#listing-and-scaling-dynos)
    [Getting Started with Node.js on Heroku](https://devcenter.heroku.com/articles/nodejs#listing-and-scaling-dynos)
  10. evenchange4 revised this gist Sep 23, 2012. No changes.
  11. evenchange4 renamed this gist Sep 23, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  12. evenchange4 renamed this gist Sep 23, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  13. evenchange4 created this gist Sep 23, 2012.
    69 changes: 69 additions & 0 deletions step
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,69 @@
    # Deploy a Node.js project on Heroku
    Step by step from command line
    by Michael Hsu
    ## Quick start
    ### Create a Node.js web framework 'express'
    ```
    $ express myfirstexpress && cd myfirstexpress
    ```
    ### Declare dependencies with NPM
    ```
    # /package.json
    {
    "name": "application-name",
    "version": "0.0.1",
    "private": true,
    "scripts": {
    "start": "node app"
    },
    "dependencies": {
    "express": "3.0.0rc4",
    "jade": "*"
    },
    "engines": {
    "node": "0.8.x",
    "npm": "1.1.x"
    }
    }
    ```
    ### Install your dependencies (-l 處理相依性)
    ```
    $ sudo npm install -l
    ````

    ### Declare process types with Procfile
    ```
    # create '/Procfile'
    web: node app.js

    # test start
    $ foreman start
    ```

    ### Git
    ```
    $ git init
    $ git add .
    $ git commit -m "init"
    ```

    ### Create Heroku app
    ```
    $ heroku create myfirstexpress
    ```
    ### Deploy on Heroku
    ```
    $ git push heroku master
    ```
    ### Run server
    ```
    $ heroku ps:scale web=1
    Scaling web processes... done, now running 1

    # check server
    $ heroku ps
    === web: `node app.js`
    web.1: up for 10s
    ```
    ## Reference
    [Getting Started with Node.js on Heroku](https://devcenter.heroku.com/articles/nodejs#listing-and-scaling-dynos)