Introduction to the Node.js API
Learn about the Node.js API, and set up our project folder to practice newly learned concepts.
We'll cover the following
By the end of this chapter, we’ll be able to do the following:
- Use the
fs
module to access and interact with the file system. - Use the
process
module to interact with the current Node.js process.
Node.js API overview
Let’s get started with Node.js by exploring its module system.
The module system allows us to load built-in Node.js modules as well as third-party libraries into our application to perform various tasks, including but not limited to the following:
- Create web servers
- Manipulate the file system.
- Make HTTP requests
- Connect to a database.
In this chapter, we’ll explore two popular and widely used built-in Node.js modules: process
and fs
.
We’ll also apply the http
and https
modules to create web servers, make HTTP
requests, and perform other networking tasks.
Setup
Follow the setup instructions below:
- Inside
intro-to-nodejs-course
, create a subfolder callednodejs-api
, and move into it:
mkdir intro-to-nodejs-coursecd intro-to-nodejs-coursemkdir nodejs-apicd nodejs-api
- Inside
nodejs-api
, create these files:file-system.js
,process.js
, andtest.txt
.
touch file-system.js process.js test.txt
Try the steps above in the provided terminal.
Later, we’ll be using some dmmy text in test.txt
, which is the file we will interact with in this chapter.
The pain itself is love, the main storage system. Pellentesque ac members disgraceful Some life warm fans It is also important to choose the bears, not the economic lion, but the coach. Fusce vulputate venenatis magna sit amet tempor. Some of the entrance to the entrance is wise and of course. Quisque venenatis vulputate viverra. Until he wants the cat, the warm and the customers, and not the arrows. Aenean in nisi ac nibh luctus blandit a et dolor. It's at the moms. Morbi eros diam, makeup of the life of the kids that, of course not eros. Integer consequat augue eu viverra dapibus. Tomorrow the pregnant, the tormentor the poverty of the teenagers, the soil of the cartoon my own, the quiver was the price of the wish was incredibly. It's life, eros When the pain of the arrows was temporary, so that the main reason was the valley of the pet.The pain itself is love, the main storage system. Pellentesque ac members disgraceful Some life warm fans It is also important to choose the bears, not the economic lion, but the coach. Fusce vulputate venenatis magna sit amet tempor. Some of the entrance to the entrance is wise and of course. Quisque venenatis vulputate viverra. Until he wants the cat, the warm and the customers, and not the arrows. Aenean in nisi ac nibh luctus blandit a et dolor. It's at the moms. Morbi eros diam, makeup of the life of the kids that, of course not eros. Integer consequat augue eu viverra dapibus. Tomorrow the pregnant, the tormentor the poverty of the teenagers, the soil of the cartoon my own, the quiver was the price of the wish was incredibly. It's life, eros When the pain of the arrows was temporary, so that the main reason was the valley of the pet.There is no one who can rely on the Olympics, sometimes the average football, before the throat. Until I am pure, and do not start to live, nor do I decorate it. Until the pain of life is tortured. Mauris vel tempus augue, in the fear of the couch. Proin tincidunt lacus at hendrerit hendrerit. Until neither before nor in the face of the man who is always in this bed. Pellentesque malesuada vulputate ante, sed sollicitudin sapien aliquet quis. For the biggest, bears the most exciting dishes, just wants to put down the will, or the quiver just doesn't want the lake. For the fun of the arches of life, let the fear of the arrows be fun. That's a lot of life's arrows. The laughter was said to miss.For the consequences of any urn Each time there is a lot of time, it is an element of eros. But that's what he wants himself to mourn for the couch, and not even the ugly. Now the time is now valley, it is important to lay down my keyboard a. Maybe not even in the borders, not just in the immune system, but in the quiver bed. How to get the hairstyle. The entrance to the entrance of the orcs in front of the very first layer of mourning and vengeful care lay down the bed; Aeneas can drink, pure but cartoon vehicles, the lion of the world is a networks of teenagers In the vehicles of the average cushion, any ferry aircraft, cartoon free. Who is the tormentor of the vengeful factors, the problems of the environment, nor the ends Until the hands of a real estate.At some point It's one of the most exciting and venenatis members. In this street was said to have dwelled. But there is no normal time for pregnancy. But before and after, the biggest factor is unemployment. It was a gas or a lion. You need someone who wants to be wise in now Integer commodo, cat eu commodo tincidunt, leo dolor pulvinar neque, in the throat the bow is great and the eros. In the very scenario, bears at this price, mourning at pain. Proin vitae lorem felis. No easy bed, this quiver is a worry, the vehicle wants the bureau to start, the advantages of the torturer bow a sem. The kids who dwell in the sickness of the sad old age, and the nets and the hunger and the ugly want. There is no such thing as ugly or sad before the throat, nor is it ugly. But the time, the freestyle and the want of the health, the laughter of the arrows nor the pain