Question

Getting started with NodeJS, first Hello World app, prerequisites for app development and api

Posted January 30, 2021 122 views
NginxMiscellaneousNode.jsGetting StartedGitDigitalOceanDeploymentInitial Server SetupBuilding on DigitalOcean

I am new to NodeJS and I have a droplet edshare.tech

Editing the helpText with the shark gif works but I cannot see a console output.

On Chrome I get: “DevTools failed to load SourceMap: Could not load content for chrome-extension://fehcbmngdgagfalpnfphdhojfdcoblgc/static/js/contentScript.js.map: HTTP error: status code 404, net::ERRUNKNOWNURL_SCHEME”

On Firefox: Error: Can’t find profile directory.

Restarting the hello app with pm2 is fine. I do it with the console of WinSCP


I need some tutorial or example for these very first steps to running a hello world app, adding some code and test it.
Could someone help me?


Some more specific questions

  • what is to be done with this 3000 port?
  • I can cd in all directories. But how can I run apps in these directories?
  • How can I use, for instance, index.js instead of hello.js - where is the attribution of apps to paths?
  • Next step after “hello world”: the Airtable API
  • Any configuration required for Nginx
  • Suitable hello world examples on Github?
  • Better alternative to WinSCP (working on Windows)
  • Sometimes the WinSCP console says I need an interactive authorization or sudo. What is the easiest way to use the full range of commands?

Any hint would help! <3

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hi there @eckard.ritter,

I believe that a great resource for learning Node.js is this free eBook here:

How To Code in Node.js eBook

Regarding your questions:

  • Port 3000 is the port that the Node.js service is running on, later on you can setup an Nginx reverse proxy and proxy the traffic to port 3000 as explained in this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

  • You can start an app from any directory as long as your project is stored in there

  • Here is a link to a Hello World project on GitHub that also uses index.js:

https://github.com/johnpapa/node-hello

  • In case that you get an unauthorized message in WinSCP you need to use the command line and add the sudo keyword in front of your command.

  • Here are a couple of alternative terminals for Windows:

PuTTy
Terminus
MobaXterm

Hope that this helps.
Regards,
Bobby

by Brennen Bearnes
Node.js is an open source JavaScript runtime environment for easily building server-side and networking applications. Node.js applications can be run at the command line but this guide focuses on running them as a service using PM2, so that they will automatically restart on reboot or failure, and can safely be used in a production environment.

Thanks so much @bobbyiliev for your extensive and helpful answer. That’s going to save me many hours.
Best,
Eckard

Submit an Answer