To make objects, functions, classes or variables 🔔 available to the outside world, simply export them and then import them into other project files where necessary.
Let's get started with
Node.js just by typing node in the console:
If you don't have it, then download and install it on your computer.
Now let's try to print something:
Feel free to experiment with
Node.js using this interface: it is common to test small pieces of code here if it is not practical to put them directly into a file.
It's time to create our Hello Node.js application!
Let's start by creating the
index.js file. With the next command we create the folder
myProject and enter it.
Now we create the
index.js file itself
Open your code editor or download and install it. We recommend VS Code.
Open the code editor and add the folder of the project we created to it.
Now open the side menu by clicking this icon.
Copy the following piece of code into it:
To run this file, you must reopen your terminal and navigate to the directory where
index.js is located.
VS Code this can be done by clicking on these icons.
And choose the tab
Once you have successfully navigated to the desired location, run the file using the command
You will see that this command will produce the same output as before, printing the string directly to the terminal.
Thanks goes to these wonderful people (emoji key):
🐛 🎨 🖋
🖋 🐛 🎨