Repository
https://github.com/nodejs/node
Introduction
Javascript runs almost anywhere. It is like a passport that can take you to any country. How else do you describe a language that puts
your application on almost any platform. Python does something similar but doesn’t run on a browser. Javscript does .
This post will teach you some things you should do quickly before you get stuck in some really bad Javascript mud.
Post Body
Learn What Async/Wait and Call Back Hell is.
Mr. Hackathon: What! Didn’t you read the documentation?
Mr. Appathon: No, sire
Mr. Hackathon: Then, how did you build the app?
MR. Appathon: I like to dive in first , then read the swimming manual while I drown.
The truth is that many of us learn like that, we read the basic parts of the documentation and run away in excitement until we get un-
excited with new concepts we forget to read about. I am not about to judge that. Everyone has a right to learn anyhow they so wish.
Here is what I am here to do, if you like Mr. Appathon above , you didn’t read the whole documentation of JS before starting up and the
you still don’t know what Async/AWAIT and CALLBACK hells means, leave this article, close your browser , close your eyes , tell yourself
you have done something wrong, then search google or buy a book to learn that shit.
When you are done, come back and read the rest of this article.
Getting stuck in Callback Hell is always because you didn’t know it existed before.
learn the importance of ‘NPM LINK’ , it will save you time and internet data. Why waste Data?
You could easily read about this off the internet but let me give you a summary of what it does.
Nodejs Modules can be installed globally to work on any directory on your pc or installed locally to work within your project.
This can be done with a slight difference in the install commands as shown below:
Local Installation for Steem goes thus:
Npm install steem
Global Installation for Steem
Npm Install Steem –g
I think everybody knows that but it is worth mentioning.
When you run “npm link” in your local environment, it gives the app in the local environment access to all modules you installed globally
with Npm Install <module> –g
.
So, whenever you pull a new code and it has new dependencies, running npm install
on the code will not prompt the dependency to
reinstall all over again. If you are a beginner and you are not been faced with some special needs , I suggest you always install your
apps with npm install –g
and consequently with npm link
. This saves you a lot of time and makes development and local testing easier.
npm install nodemon –g
Run this commands above and you will be so happy you did.
I hope by now , you know that to run a script on your CMD or SHELL, you need to use node test.js
, this command will run a javascript
file relative to the path you are cd-ed into with a name test.js
.
Remember that anytime you make any changes to this file, you need to go back and restart this file again with node test,js
to see the
new changes.
Here is the what nodemon does, it restarts the file for you on detection of new changes, by the time , you’re checking your shell/cmd or
your front end , the changes are already running.
The rule is that to put nodemon to action, install it globally and run your scripts like this nodemon test.js
instead of like `node
test.js`. This saves you a lot of stress.
NOTE: In case you need an extra npm linking feature , try and use this awesome tool : NPM LINK SHARED, you can find it [here on
github]( “https://github.com/OrKoN/npm-link-shared”).
Good Bye Until For now.
Hey there!
This is an interesting contribution, but it isn't quite a blog post. With more detail and specificity, a similar post could fit our Tutorials category. We expect blog posts to be more editorial and personal, whereas this is almost entirely technical.
If you want to contribute content that is relevant to Utopian, please read our guidelines. I would also recommend reading our weekly Top Of Utopian posts to get an idea of the kind of content we particularly like.
I look forward to seeing awesome relevant content from you in the future.
Due to ineligibility, your contribution has not been evaluated.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]