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