Node.js Meetup — Uniphyd.
Node.js Meetup — Uniphyd.
What a perfect meet up it was! Right from the educative talks and hand-on session on node.js to the cheerful laughters and the pizzaaa🍕— Uniphyd. (@uni_phyd) August 3, 2018
Thank you #UniphydFam for making this happen. ♥️. #WeAreUniphyd pic.twitter.com/SnszHzEIiM
Why is this important for you?
What we’ll do
To get accustomed to creating back-end services we’ll create a basic weather app. If you think about what makes up a standard weather app we imagine a…
We tend to forget that behind all the prettiness is a lot of dynamic information being exchanged and updated in real time. With Node.js we can implement features like this and more. Before we proceed, feel free to download Node.
- We can initialize a variable and assign a value to it in a single statement.
Your first Node App
With node, whenever we start a new project we use npm init.
After installing Node.js, create a file called index.js and enter the following line of code to print out something special.
We use node [filename] to run a file. In our case, we enter node index.js and should get the following output.
The Weather App
Using a lot of the code from this video, we created a repository you can clone on the Uniphyd. GitHub account. uniphyd/WeatherNow WeatherNow - A simple Weather app using Node.jsgithub.com
After cloning the repo, we need to run npm install in the directory to install all the project packages. When that’s done, run the app with node app.js . Go to your localhost:8081 and see the magic.
N.B : We Vadodara as our city, your city may vary, so you might have to change the API URL to match your cities. The Open Weather Map website has great documentation on how to do this.
The app is great and all but there’s a problem, it can only run locally on our devices.
Forward pun of the year medals to my Twitter.
Heroku is a cloud platform that lets us deploy and eventually scale our apps. They have an amazing tutorial that takes us through each step of deploying our Node.js app. Getting Started on Heroku with Node.js | Heroku Dev Center A step-by-step guide for deploying your first Node app and mastering the basics of Herokudevcenter.heroku.com
I went through this tutorial and applied it to the weather app we created. At the end I got a cute little URL for my app. Like we said before, weather apps look pretty, this one not so much. In the next post, we’ll go through view engines and how to make our Node App visually pleasing. If you missed my talk on community during the meetup, there’s a post on it that you can read through. Enjoying Coding *Straight into it.
Contact us on Twitter for questions. We’d be happy to talk to you. Hope you enjoyed this short post made with ❤ from Uniphyd. #WeAreUniphyd.