Book Image

Web Developer's Reference Guide

By : Joshua Johanan, Talha Khan, Ricardo Zea
Book Image

Web Developer's Reference Guide

By: Joshua Johanan, Talha Khan, Ricardo Zea

Overview of this book

This comprehensive reference guide takes you through each topic in web development and highlights the most popular and important elements of each area. Starting with HTML, you will learn key elements and attributes and how they relate to each other. Next, you will explore CSS pseudo-classes and pseudo-elements, followed by CSS properties and functions. This will introduce you to many powerful and new selectors. You will then move on to JavaScript. This section will not just introduce functions, but will provide you with an entire reference for the language and paradigms. You will discover more about three of the most popular frameworks today—Bootstrap, which builds on CSS, jQuery which builds on JavaScript, and AngularJS, which also builds on JavaScript. Finally, you will take a walk-through Node.js, which is a server-side framework that allows you to write programs in JavaScript.
Table of Contents (22 chapters)
Web Developer's Reference Guide
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
9
JavaScript Expressions, Operators, Statements, and Arrays
Index

File and process management


We will start our overview of Node.js with the basics. This will include loading modules, managing processes, handling files and paths, and REPL (Read Eval Print Loop). These are things that virtually any Node.js project will need.

Modules

Node.js is a modular system. Much of the functionality of Node.js is contained in modules that must be loaded at runtime. This makes the knowledge of loading and building modules a core requirement to using Node. Here are the references you can use for your Node modules:

  • require()

  • modules.export

require()

This loads the module at the given path:

require(path)
Return value

The return value will be an object. The properties of this object will vary, depending on what is loaded. We will cover module.exports next, which is what module designers and even you can use to set the value of this return value.

Description

The require() function is used to load the module at a path, where the path can be a core module (a module packaged with...