Posts

Showing posts with the label nodejs

Transitioning from JavaScript to Node.js

Image
JavaScript developers who initially focused on front-end development may transition to Node.js to become full-stack developers. This enables them to work on both the client side (browser) and server side As JavaScript developer, we know that the language is client-side, meaning it can run in a browser environment only and access browser APIs such as DOM and web APIs. What if we want to run javascript outside of a browser (client side)? Can we run javascript in server side like java? Well the answer is NO. With the help of Node.js, Javascript may now be executed on the server side.   How? Let's explore what node.js is and how you can use it to run JavaScript on the server side. Node JS Node JS is itself a runtime environment for executing javascript code outside browser(Client Side) i.e, on server . It uses Chrome’s V8 javascript engine to do that. And it provides additional built-in library for handling various tasks such as file I/O, networking and HTTP operations.   Because of

Host Your Node.js App on AWS EC2 Instance for Free in 2024

Image
Contents Introduction Prerequisites Launch an EC2 Instance Prepare the EC2 Instance Connect to the EC2 Instance Install Dependencies and Start Your App in instance terminal Access Your App Run your server in auto mode using pm2 Conclusion 1. Introduction Are you a developer looking to host your Node.js app on a reliable and scalable platform? Amazon Web Services (AWS) offers a variety of services to meet your hosting needs, including EC2 instances. In this tutorial, we will guide you through the process of hosting your Node.js app on an AWS EC2 instance for free using the AWS Free Tier. 2. Prerequisites Before we begin, make sure you have the following prerequisites in place: An AWS account. If you don't have one, sign up for free at https://aws.amazon.com/. Basic knowledge of Node.js.  3. Launch an EC2 Instance 1.      Log in to the AWS Management Console. 2.      Navigate to the EC2 service. 3.      Click on "Launch Instance" to start the instance creation process . 4.

Handling Asynchronous Function is Crucial Part of Any WebDeveloper in 2024

Image
  First question anyone should ask is what is Asynchronous function and how it is different from synchronous function and what it look like. We will discuss this topic in terms of JavaScript. What is Synchronous functions? As the name suggests synchronous means to be in a sequence, i.e. every statement of the code gets executed one by one. So, basically a statement has to wait for the earlier statement to get executed. What is Asynchronous functions? Javascript is a single-threaded language , which means that function that deals with things like input-Ouput, Sockets and the network, in general, would block the main thread when executed. To have the ability to write concurrent code that does not block the main thread with tasks that can be slow(needs some time to finish), JS uses what is called the Event Loop. So, an asynchronous function is just a function that can be put in a queue and have the results of the function checked in later, without blocking the main thread.