Awesome Node.js development environment with Heroku and Cloud9

As we know,Heroku enables developers to build and run Node.js apps on it,and the most important,it is FREE.
Today I will try to setup an awesome Node.js development environment and deployment with Cloud9 and Heroku.

Of course, we need to sign up first.

1.Sign up

1.https://c9.io/
2.https://www.heroku.com

2.Create a new App in heroku

Create a new App with an unique App name such as “myapp”,then we will have a public domain : https://myapp.herokuapp.com. heroku-1 heroku-2 heroku-3

3.Create a new Node.js Workspace in Cloud9

Cloud9 Workspace node dev   Cloud9

4.Remove unuseful libraries via Console

node dev Cloud9 uninstall

5.Edit the main script file

Change “server.js” to “app.js” with the following source code.

6.Edit package.json

The Heroku Node.js buildpack is employed when the application has either a package.json file or a server.js file in the root directory.
Edit “package.json” file with the following source code.

7.Create Procfile file

The command in Procfile that will be executed when a dyno is started.
Create “Procfile” file with the following source code.

8.Deploy

The last work, Deploy the whole files to Heroku via Console. node dev  Cloud9 resources
The message “Verifying deploy…. done.” will be shown if the Deploy is done,
then we can see the “Hello World” from the public domain https://myapp.herokuapp.com. heroku Hello World I will share you more infomation about Node.js and Heroku in the next posts,
Enjoy it!

Post Tagged with , , ,