Part 2 - JavaScript first steps: VS Code and installing an NPM package

avatar

express

In the last tutorial, we have seen how to install NodeJS and start a new project on your machine.
https://ecency.com/hive-196387/@igormuba/javascript-first-steps-installing-node

On this one let's choose a code editor and install an npm package. Packages are code written by other devs to make your job easier. You could write it all by yourself, but by using packages you can skip the boring and repetitive stuff and focus on the functionality of what you are creating.

Install VS Code

VS Code is my favorite code editor, it is lightweight, intuitive, and widely adopted, which makes it easy to find resources about it online.

The installation is straightforward for every major operating system and you can get it from their website:
https://code.visualstudio.com/

NPM and packages

If you have followed the last tutorial you should have a folder where you created a new NPM project.
If you did not, do it:
https://ecency.com/hive-196387/@igormuba/javascript-first-steps-installing-node

NPM is my package manager of choice, there is also Yarn but I won't get into that in this tutorial.

Go to the NPM package explorer at https://www.npmjs.com/ and search for express:
image.png

The first result of the search is the package we want

Installing the ExpressJS package

On the ExpressJS page, you can find the documentation and more information about the package.
https://www.npmjs.com/package/express

To install it, using the terminal on your computer, access the directory of your npm project and run the command npm i express and it should automatically install and configure. Be careful to run inside the folder of your project. You will only need to do this once in the lifetime of your project in your computer (if you upload or send it to someone else they will need to do that).

The command npm i express is the same for any operating system, if you have Node/NPM in your machine, but some packages on Windows need to be installed from the windows command prompt, while others can be installed through git-bash, which I prefer to use, although it has some issues.

image.png

If you have VS Code installed properly, you can type code . on the terminal to open the VS Code editor in the folder you are at. From there you can see what was installed under node_modules

image.png

Click here and vote me for witness on HiveSigner

Or use your preferred signing tool to vote me:


https://vote.hive.uno/@igormuba



0
0
0.000
6 comments
avatar

Fala Igor! tudo bem? voce tem discord? poderia me tirar umas duvidas do node.js e api da hive?

0
0
0.000
avatar

Tenho, mas que tal mandar a dúvida aqui? Daí eu vejo se posso ajudar você e deixar postado aqui que o Google indexa, isso é útil pra atrair pra Hive usuários que pesquisarem sobre o assunto!

0
0
0.000
avatar

Na verdade queria trocar uma ideia, pq provavelmente vou ter algumas perguntas. Queria ver se vc pode compartilhar algum exemplo de codigo pra eu poder começar. Eu estou la naquele servidor do discord HiveBR. Tem uma galera legal lá também, acho que ia ser legal ter voce la.

0
0
0.000
avatar

Beleza, manda mensagem lá, igormuba#6942

0
0
0.000
avatar
(Edited)

mandei um friend request

0
0
0.000
avatar

tentei mandar uma mensagem, mas vc só recebe de amigos ou se tivermos um servidor em comum. mandei um friend request

0
0
0.000