Nodejs For beginners

Saniaalikhan
4 min readDec 5, 2020

Well, I know there are a lot of people out there who wants to learn Node.js or any Technology/Framework etc. But don't know from where to start.

Let’s just give me a head start to you guys.

  1. Just search what Node.js is and why do you need to learn it.(I just found it when i myself was looking for Node.js tutorials and etc)

What is Node.js?
Node.js is an open-source, cross-platform runtime environment used for the development of server-side web applications. Node.js applications are written in JavaScript and can be run on a wide variety of operating systems.

Node.js is based on an event-driven architecture and a non-blocking Input/Output API that is designed to optimize an application’s throughput and scalability for real-time web applications.

Over a long period of time, the framework available for web development were all based on a stateless model. A stateless model is where the data generated in one session (such as information about user settings and events that occurred) is not maintained for usage in the next session with that user.

A lot of work had to be done to maintain the session information between requests for a user. But with Node.js, there is finally a way for web applications to have real-time two-way connections, where both the client and server can initiate communication, allowing them to exchange data freely.

Let’s look at some of the key features of Node.js

Asynchronous event-driven IO helps concurrent request handling — This is probably the most significant selling point of Node.js. This feature basically means that if a request is received by Node for some Input/Output operation, it will execute the operation in the background and continue with processing other requests.

Node uses the V8 JavaScript Runtime engine, the one which is used by Google Chrome. Node has a wrapper over the JavaScript engine which makes the runtime engine much faster and hence the processing of requests within Node also become faster.
Handling of concurrent requests — Another key functionality of Node is the ability to handle concurrent connections with a very minimal overhead on a single process.
The Node.js library uses JavaScript — This is another important aspect of development in Node.js. A major part of the development community is already well versed in javascript, and hence, development in Node.js becomes easier for a developer who knows javascript.
There is an active and vibrant community for the Node.js framework. Because of the active community, there are always keys updates made available to the framework. This helps to keep the framework always up-to-date with the latest trends in web development.

Who uses Node.js
Node.js is used by many large companies. Below is a list of a few of them.

Paypal — A lot of sites within Paypal have also started the transition onto Node.js.
LinkedIn — LinkedIn is using Node.js to power their Mobile Servers, which powers the iPhone, Android, and Mobile Web products.
Mozilla has implemented Node.js to support browser APIs which has half a billion installs.
eBay hosts their HTTP API service in Node.js

When to Use Node.js
Node.js is best for usage in streaming or event-based real-time applications like

Chat applications
Game servers — Fast and high-performance servers that need to processes thousands of requests at a time, then this is an ideal framework.
Good for collaborative environment — This is good for environments which manage documents. In a document management environment, you will have multiple people who post their documents and do constant changes by checking out and checking in documents. So Node.js is good for these environments because the event loop in Node.js can be triggered whenever documents are changed in a document managed environment.
Advertisement servers — Again here you could have thousands of request to pull advertisements from the central server and Node.js can be an ideal framework to handle this.
Streaming servers — Another ideal scenario to use Node is for multimedia streaming servers wherein clients have request’s to pull different multimedia contents from this server.
Node.js is good when you need high levels of concurrency but less amount of dedicated CPU time.

Best of all, since Node.js is built on javascript, it’s best suited when you build client-side applications which are based on the same javascript framework.

When to not use Node.js
Node.js can be used for a lot of applications with various purposes. The only scenario where it should not be used is where there are long processing times, which is required by the application.

Node is structured to be single-threaded. If an application is required to carry out some long-running calculations in the background, it won’t be able to process any other requests. As discussed above, Node.js is used best where processing needs less dedicated CPU time.

2. Download nodejs on your windows or mac.

3. Use a good editor (I myself prefer Vs code).

4. Start with RestApi’s with Nodejs.

Dont use any database. Just learn to make Rest Api’s and then how to set up nodejs packages through Npm or yarn you can choose any of these package managers.

Use es6 js version.

5. Download Postman to test those Api’s.

--

--

Saniaalikhan

Tech Entrepreneur and Web Engineer driving innovation and business growth through technology. Follow: LinkedIn https://www.linkedin.com/in/sania-khan-242677119/