Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (12.9k points)

I'm interested in hosting nodejs applications in a cloud and I'm looking for a free cloud hosting for my purpose. I've found that Amazon has one but I have the following question: Are there any tutorials around how I can set up and run nodejs application in Amazon EC2?

1 Answer

0 votes
by (18.2k points)

Below mentioned are some general steps that you can follow to host a basic Node.js application running on EC2 Ubuntu instance:

1. launch an instance and SSH into it

2. Install Node.js using the following command:

sudo apt-get install nodejs

3. create a file named test_server.js with the following content:

require("http").createServer(function(request, response){

response.writeHeader(200, {"Content-Type": "text/plain"});  

response.write("Hello World!");  

response.end();

}).listen(8080);

4. Start the server using the following command:

node test_server.js

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...