Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Nithin KV
Nithin KV
809 Points

How to run nodeJS in server?

Hi,

This is a basic question. If i'm using nodejs for my web application, how to run this in server. I know 'node app.js' is the command. But do we run this command in server. If yes what is correct procedure to use nodejs.

Please Help

4 Answers

Your Question is not clear enough, Node.js can create or connect to a server. It all depends on what you're truly asking

Nithin KV
Nithin KV
809 Points

Hi, Thanks for your reply. I wrote some nodejs code in app.js file. I want to make it live. My website is hosted in AWS. Code is for something like real time data updation. What is the procedure to achieve it. Is it like upload app.js to aws and run 'node app.js' in CLI?

Yes, That should work. Have you tried it?

Nithin KV
Nithin KV
809 Points

No i didn't actually Im confused. If I run this "node app.js" once the code will work with all client right? do I need to run this again in any time?

Uhmmn..It depends on what the nodejs code does, If it runs and does its function once and requires you to run again, You might need to write a javascript code that requires and runs the nodejs code on the CLI every time its needed. You could contact some of the instructors for help on that.