Deploy the node. JS app on the Heroku cloud Platform

Source: Internet
Author: User
Tags email account heroku toolbelt

Recently using node. js and WebSocket wrote an online chat room, looking for a support node. js and support WebSocket free platform deployment up, my personal blog site is deployed on Sina SAE, but Sina SAE does not support node. js, but chose to choose only Heroku most It fits.

Heroku is a PAAs cloud platform built on top of AWS and now supports Ruby, node. js, Python, Java, and PHP, and the code is deployed through Git, which is automatically compiled and run. I use Heroku feeling is, in the Heroku official website register an email account, in the local knock a few lines of command, my application will pass up, then can be in the Internet access, the whole process is so easy.

Now let's share the whole process.

First Step: Register

https://www.heroku.com/

Installing Heroku Toolbelt

Step two: Create an app

After registering successfully, go to the Control Panel page, click on Create a new app, fill in your app name, click Creat app to create a success, then click Finish Up, then you can access the app home page via yourAppName.herokuapp.com The Of course you can also use the command to create the app locally, if it is a novice or suggest to create on the official website, intuitive and clear.

Step three: Upload apps

In fact, the process and upload code to github almost, first CD to the application directory, you need to add a file in this directory procfile, the content is a line of code:

   1: web:node app.js

Then, under the current directory, right-click Git Bash, log in, enter your username and password:

   1: heroku Login


Now you can use the foreman Start command to check if the application code can run on Heroku, if you see no error in the output, it is basically normal.

   1: foreman start

Use git to synchronize your code after two previous steps

  
   1: git init
   2: git Add.
   3:"Init"
   4: git remote add heroku [email protected]:yourappname.git
   5: git push Heroku Master

After the upload is successful, you can visit http://yourAppName.herokuapp.com/, over.

Deploy the node. JS app on the Heroku cloud Platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.