Hands-On Full Stack Web Development with Aurelia - Diego Jose Argüelles Rojas - E-Book

Hands-On Full Stack Web Development with Aurelia E-Book

Diego Jose Argüelles Rojas

0,0
31,19 €

oder
-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Hands-On Full Stack Web Development with Aurelia begins with a review of basic JavaScript concepts and the structure of an Aurelia application generated with the Aurelia-CLI tool. You will learn how to create interesting and intuitive application using the Aurelia-Materialize plugin, which implements the material design approach. Once you fully configure a FIFA World Cup 2018 app, you'll start creating the initial components through TDD practices and then develop backend services to process and store all the user data.
This book lets you explore the NoSQL model and implement it using one of the most popular NoSQL databases, MongoDB, with some exciting libraries to make the experience effortless. You'll also be able to add some advanced behavior to your components, from managing the lifecycle properly to using dynamic binding, field validations, and the custom service layer.
You will integrate your application with Google OAuth Service and learn best practices to secure your applications. Furthermore, you'll write UI Testing scripts to create high-quality Aurelia Apps and explore the most used tools to run end-to-end tests. In the concluding chapters, you'll be able to deploy your application to the Cloud and Docker containers.
By the end of this book, you will have learned how to create rich applications using best practices and modern approaches.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB

Veröffentlichungsjahr: 2018

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Hands-On Full Stack Web Development with Aurelia

 

 

 

Develop modern and real-time web applications with Aurelia and Node.js

 

 

 

 

 

 

 

 

Diego Jose Argüelles Rojas
Erikson Haziz Murrugarra Sifuentes

 

 

 

 

 

 

 

 

 

 

 

BIRMINGHAM - MUMBAI

Hands-On Full Stack Web Development with Aurelia

Copyright © 2018 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Commissioning Editor: Kunal ChaudhariAcquisition Editor: Shweta PantContent Development Editor: Flavian VazTechnical Editor: Vaibhav DwivediCopy Editor: Shaila KusanaleProject Coordinator: Devanshi DoshiProofreader: Safis EditingIndexer: Pratik ShirodkarGraphics: Jason MonteiroProduction Coordinator: Shraddha Falebhai

First published: June 2018

Production reference: 1120618

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.

ISBN 978-1-78883-320-2

www.packtpub.com

Any success I get is thanks to my family. I would not be who I am without their guidance. Special thanks to my mom, the best person in the world, who is everything in my heart. To my dear J, my friends, and my little dog, you all fill my life with happiness. 
– Diego Jose Argüelles Rojas
I dedicate this book to my beloved family. For giving me all the unconditional support and for their constant sacrifice in helping me become the man I am today. I love them with all my heart. I dedicate it especially to my past self, to that child who fought very hard to achieve his goals. Little Erikson, we did it!
- Erikson Haziz Murrugarra Sifuentes
mapt.io

Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.

Why subscribe?

Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Mapt is fully searchable

Copy and paste, print, and bookmark content

PacktPub.com

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

Foreword

I had my first encounter with web technology in the late 1990s. At that time, and for a number of years that followed, I was knee-deep in native desktop development. The Web, with its static pages and limited interactivity, held no interest for me. Then, the iPhone came, and everything changed. Very quickly, the world of one-platform desktop application development was no longer a viable business. Customers demanded rich experiences that worked equally well on iPhone, iPad, Android, Windows, Mac, Linux, and much more. In response, I returned to revisit the Web, hoping to find a way to build native-like experiences in a cross-platform way. In the 10-year span since I first searched, the Web had grown considerably. What was once a world of lifeless text and few images is now a rapidly evolving platform. Styling, animation, layout, SVG, drawing APIs, and many more features were available or soon to be shipped as part of HTML5. JavaScript was also being reborn with built-in primitives for async programming and new language constructs for classes, lambdas, destructuring, and more. All the raw materials for a rich application platform were there, yet something was missing. There was still no way to create components, that is, no built-in concept of an "app," and no mechanism for building multi-screen experiences. Enter Aurelia. In early 2015, we shipped the first alpha of Aurelia, a platform with high-performance component rendering rich data-binding, routing, publish-subscribe, data validation, i18n, and more. We took everything we'd learned from building rich desktop applications over the years and reimagined it on top of the modern web. The result is one of the most elegant application frameworks today, and the subject of the book you're holding in your hand. I'm excited about Full Stack Aurelia Web Development. You're about to embark on an amazing journey that spans the breadth of the modern web. If you haven't looked at HTML, CSS, and JavaScript in a while, don't worry. This book will bring you up to speed on new language standards and browser capabilities. From there, you'll learn how to build applications by thinking in terms of "components." You'll see how to style, test, and debug components; assemble components into screens coordinated by a router; manage data and communication with the server; and even cross-component messaging, modal dialogs, and internationalization. If you're ready to dive in to modern web development and are looking for a simple and intuitive guide into this exciting new world, you've found it right here. I can't wait to see what you build. Enjoy the journey!

 

Rob Eisenberg 

Aurelia Project Lead

Contributors

About the authors

Diego Jose Argüelles Rojas is a software developer born in Peru, passionate about technology, music, comics, and beer. He currently works for companies in North America and Europe remotely and simultaneously finishing his professional studies in Brazil. His main objective is to contribute to projects of social impact and to make the world a better place for all.

 

Erikson Haziz Murrugarra Sifuentes is a computer engineer, scrum master, and DevOps Master with 8 years of experience in building different kinds of software solutions, such as his own programming language, called Erlan, and his own Operating System, called EriOS. He is an Amazon-certified solutions architect and works as a full stack software engineer at Verizon Enterprise. He is an expert in Big data / Business Intelligence and has implemented complex big data solutions for one of the biggest bank of Peru called BCP. 

About the reviewer

Julien Enselme is a young full stack developer from France. He has worked in Switzerland on Geographic Information System (GIS) projects with Python and AngularJS. He is currently working in France, mostly on Django-related projects. He stumbled upon Aurelia while the framework was still in the beta stage and immediately loved it. He now uses it on his personal projects and hopes to use it professionally as well. He made several blog posts on Aurelia and has even made some contributions.

 

 

Packt is searching for authors like you

If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.

Table of Contents

Title Page

Copyright and Credits

Hands-On Full Stack Web Development with Aurelia

Dedication

Packt Upsell

Why subscribe?

PacktPub.com

Foreword

Contributors

About the authors

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Conventions used

Get in touch

Reviews

Introducing Aurelia

JavaScript fundamentals

Dynamic typing

Object oriented

Functional

Prototyped

Events handling

The ECMAScript standard

ES 6

Arrow functions

String interpolation

Destructuring

Setting up our environment

Installing Node.js

The Node Package Manager

NPM website

NPM Registry

NPM CLI

Common NPM operations

Updating NPM

Installing NPM packages

Versions

The package.json file

Dependencies and devDependencies

The Aurelia framework

What is a JavaScript framework?

Why use a JavaScript framework?

JavaScript framework comparison

Why Aurelia?

Angular

Technical information

Dependency injection

Component encapsulation

React.js

Technical information

Dependency injection

Component encapsulation

Aurelia

Technical information

Dependency injection

Component encapsulation

Aurelia command-line tool

Installation

Creating a new application

Running our Application

Testing our application

Building our application

Generating custom resources

World Cup app overview

Exploring the application features

Matches explorer

Listing the matches

Creating a new Match

Teams explorer

Listing the teams

Creating a new team

News

Listing the News

Create a New

Social authentication

Creating our app

The project structure

The Bootstrap process

Understanding components

Summary

Styling the User Interface

Talking about CSS

How does it work?

Exploring SASS and LESS

Variables

Nesting

Extends

If/else statements

Automating tasks with Gulp

Understanding Gulp

How does Gulp.js work?

Installing Gulp

JavaScript task

Automating tasks

Exploring CSS frameworks

Bootstrap

Material Design

Material is the metaphor

Bold, graphic, and intentional

Motion provides meaning

Semantic UI

The mobile-first approach

Configuring our project with Aurelia-Materialize

Summary

Testing and Debugging

Benefits of testing

For the development team

For the project

For the organization

For the users

Test-Driven Development

Making our code fail

Implementing the code

Refactoring our code

Aurelia testing frameworks

Learning JasmineJS

Installation and configuration

Test suites

Test cases

Expects

Learning KarmaJS

Installing karma

Configuring Karma

Testing example

Launching the test runner

Testing an Aurelia component

Coding the application

Creating the application

Creating our component

Implementing the info-box view model

Implementing the info-box view HTML template

Rendering the info-box component

Writing the test

Bootstrapping the component

Testing the component

Debugging our code

Refactoring our application

Debugging with Chrome Developer Tools

Summary

Creating Components and Templates

Lego components

A little puzzle

Learning how DI works

Managing a component's life cycle

Managing events with Aurelia

Data binding

Binding computed properties

Value converters

Routing and resources

Testing our components

Testing component life cycle

Time to practice!

Summary

Creating Our RESTful API

Understanding RESTful

Understanding HTTP

URLs

Verbs

Headers

Body

CRUD over HTTP

Designing APIs

API first

API design

Nouns as paths

HTTP verbs for CRUD

API documentation

Creating an API with Node.js

Node advantages

Asynchronous

Single-thread

Simple HTTP Server

Improving our API with Express.js

Coding our server

Using routes

Coding our project

Our project structure

Implementing the Teams API

Configuring the JSON Parser

Refactoring routes

Creating a team

Retrieving the list

Updating a Team

Deleting a Team

Summary

Storing Our Data in MongoDB

NoSQL databases

Document databases

Introducing MongoDB

Installing MongoDB

CRUD operations

Creating a document

Retrieving documents

Updating documents

Deleting documents

MongooseJS

Installing Mongoose

Configuring Mongoose

Defining schemas

Data types

Validation

Creating models

Integrating our API with MongoDB

Decoupling the Team Model

Implementing the Rest Controller

Connecting the app

Creating a new team

Listing the teams

Finding a single team

Updating teams

The async/await instruction

Deleting teams

Summary

Advanced Features on Aurelia

Subscribing and publishing events – Event Aggregator at the rescue!

Configuring Event Aggregator

publish(event, data)

subscribe(event, callbackFunction)

subscribeOnce(event, callbackFunction)

Adding more languages to our application – Internationalization!

Installation and configuration

For Webpack users

JSPM users

Aurelia CLI users

Configuring and defining our first translation files

Using the plugin – Multilanguage support!

Tracking method calls and user actions – Logging

Configuring your log manager

Modal configuration – Aurelia dialog at rescue!

Getting the Aurelia-dialog plugin

Adding dialog components to our application

Dynamic value converters – Less code, more functionality

The problem – Data is not exposed as we need

Binding custom behaviors to our application

Improving our application forms – Validators

Preparing for war – Getting the validation plugin

First steps – Defining our rules

Manipulating the DOM – Custom attributes

Understanding how computed properties work

Summary

Security

Understanding JSON Web Tokens

JWT

Custom authentication and authorization

Implementing authentication

The authentication logic

Generating the token

The authentication REST controller

Implementing authorization

Creating the Admin API

Managing matches

Creating the Match schema

Creating the REST controller

Creating Matches

List Matches

Updating the Scores

Securing the REST controller

Validate token

Validate permissions

Introducing Auth0

A simple example

Creating an account

Registering an Auth0 client application

Exploring our example application

Social Login with Auth0

Single sign-on

Summary

Running E2E Tests

Integration testing – Multiple services, one application

Configuring applications for integration testing

Mocking external dependencies

Calculating code coverage

Does our app meet our business requirements? UI testing

Scripted testing

Exploratory testing

UX testing

Planning our tests – Time for the truth

Defining common scenarios

Writing test cases

Organizing our test – Creating scripts

API test with Swagger

Installing Swagger

Summary

Deployment

Configuring our web for production

Deploying on your own server

Creating our NGINX configuration file

Creating our Dockerfile

Running our application on Docker

Deploying on Heroku

Creating a Heroku account

Preparing the application

Deploy

Deploying on AWS S3 Buckets

Uploading files

Configuring our S3 Bucket for the web

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

Preface

A few years ago, it was very common to find several IT professionals specialized in just one kind of technology, code language or platform. People dedicated to reviewing all the backend stuff thought that they do not have anything to do with the frontend layer, after all one is developed in Java and C# and the other in HTML and JavaScript. This approach was not good. As times change, we need to start understanding that one application involves not only one part of the business, such as logistic or sales. Your application should involve the entire business and represent it on a binary world with same features, restrictions, and rules. As only a backend developer, your understanding of how data is displayed to the final user is very limited. As just a frontend developer, your knowledge of how many distributed applications interact and retrieve data to be interpreted on the screen is very limited too. As a first consequence, the development time increases and the product quality is not the desired one. Many IT professionals are now leaving their comfort zone and exploring the other side. A full stack developer is not only a developer with knowledge of backend and frontend languages. A full stack developer is a professional capable of understanding and translating each business requirement into application features, knowing the general impact and the changes it could include. Their diagnostic and time duration required to deliver will be always shorter to reality because they know exactly how the current product works, with external dependencies and different platforms. 

The microservice revolution came with many changes for the industry. Nowadays, it is not enough to have a good knowledge of just one code language. NoSQL databases changed the relational paradigm, and strict object-oriented languages are now exploring the functional paradigm. These things enforces you to start understanding different programming paradigms, code languages, and frameworks. But there is one language that from its beginning, the only thing it did is grow: JavaScript. 

Throughout this book, you will be introduced to the main JavaScript concepts and start understanding how this code language works and why it is so adopted by the community. JavaScript could be used as an object-oriented language or function too. Its flexibility is one of its most awesome features, and the development speed is faster compared with other traditional programming languages. Not only this, JavaScript was empowered with their own runtime platform outside the browser, NodeJS. In this book, you will find that Node is our main partner to develop JavaScript applications, and its simplicity to include external libraries and reuse code is simply awesome.

Tools such as CSS preprocessors, task automation, and testing coverage will be also explained and will give you the knowledge to participate in any development team, understand and propose new features. Our horse battle, Aurelia, will be present in this stage. You must have heard about popular frontend frameworks, such as Angular, or libraries, such as React. Aurelia comes with a very different approach, solving most of the common problems you would find and, of course, making your development process very easy. Forget about configuring the framework and your worries about data binding, AJAX calls, integration with third-party libraries, and so on, Aurelia comes with a big variety of plugins that are ready to help you in any situation, in a very simple way, and allows you to focus only on business code. Aurelia is not just another frontend framework, it is the future of frontend development.

Over the years, JavaScript was used just in frontend layer; with NodeJS, this approach has changed too. The fact that we can execute our JavaScript code in its own runtime environment allows us to start writing backend functionalities to be consumed for the frontend layer. ExpressJS is the backend framework based on NodeJS that will allow us to write our business processing data functionalities in a very simple way, high understandable and just with a few lines of code. To complete your travel through the backend layer, we will show you how to store data in one of the most famous NoSQL databases: MongoDB. Its simplicity and speed to insert and extract data are just amazing. 

The IT world changes quickly, and you need to be updated on any change. You will also learn how to secure, test, and prepare your application for the real world and use cloud platforms to deploy your projects that are available worldwide, highly scalable, and secured. Are you ready to start your journey to become a great full stack developer?

Then, we welcome you to the new M.E.A.N. approach (MongoDB, ExpressJS, Aurelia, NodeJS).

Who this book is for

This book is perfect for IT professionals with/without hands-on experience in software development. This book will guide you to create highly scalable applications in AureliaJS by reviewing basic programming concepts and good practices, such as TDD and Security.

By the end of this book, you will become a full-stack programmer with strong knowledge of modern JavaScript frameworks, NoSQL databases, Docker, and cloud technologies.

What this book covers

Chapter 1, Introducing Aurelia, explains why JavaScript is a very good code language and how it is changing over time, the common syntax used (ES6), and a brief exploration about other modern frameworks, such as Angular and React, and why Aurelia is the best choice.

Chapter 2, Styling the User Interface, introduces you to the modern web development tools, very useful and in demand nowadays. You will learn how to make your stylesheets more friendly and readable and create automated task to execute commands to process your files. Also, you will see the current tendency in web design through the most used CSS libraries in the world.

Chapter 3, Testing and Debugging focuses on how to test your Aurelia applications to avoid potential bugs and deliver high-quality apps.

Chapter 4, Creating Components and Templates, states that it's time to start abstracting our business components and create isolated pieces that are highly reusable and easy to maintain to build your application. You will learn how to manage events and lifecycles of each part of your application, giving you total control over them.

Chapter 5, Creating Our RESTful API, deals with how to implement the backend for your example application using Node.js. Also, you will learn how to design strong APIs.

Chapter 6, Storing Our Data in MongoDB, teaches you how to integrate your Node.js backend application to MongoDB to store your application's information.

Chapter 7, Advanced Features on Aurelia, shows you more advanced features regarding data binding and other very common scenarios in your day to day work.

Chapter 8, Security, explains how to implement Authentication/Authorization and Single-Sign-On in AureliaJS using a common third-party service called Auth0. 

Chapter 9, Running E2E Tests, is the most important part in the development lifecycle. It's time to test whether all your code work and meet your business requirements, but not as isolated pieces. You will also test whether the functionality of all your components works well together.

Chapter 10, Deployment, describes how to deploy your Aurelia applications in your on-premise servers using Docker and NGINX; also, it shows you how to deploy the application to Heroku and Amazon Web Services.

To get the most out of this book

You must be familiar with at least the basic principles of one code language. Don't worry if you don't have any professional experience since this book will guide you step by step through each chapter to get the most out of it.

We recommend that you start using any Unix-based operative system (Ubuntu, Debian, and macOS). This is because it is more flexible and easy to execute tasks on Terminal.

You will need a lot of patience. No one is born with knowledge, so never give up if one concept or example is not clear at the first go.

You will also need a

 lot of practice. It's impossible to cover all the real-world scenarios in a book, so we recommend that you go three steps ahead and modify the examples, add additional features, and research a lot.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

Log in or register at

www.packtpub.com

.

Select the

SUPPORT

tab.

Click on

Code Downloads & Errata

.

Enter the name of the book in the

Search

box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR/7-Zip for Windows

Zipeg/iZip/UnRarX for Mac

7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Full-Stack-Web-Development-with-Aurelia. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

 

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.

Introducing Aurelia

If you were born in the 80s or 90s, without doubt, you were a witness to the internet evolution. The first web pages were composed only of black text in a white screen; everything they wrote was in pure HTML format, and really, really static. After some years, the first CSS was adding some color to the web, and, after some unsuccessful  attempts, JavaScript did appear.

From its first appearance, JavaScript has improved over the years and adapted to build the next generation of web pages. Many companies such as Microsoft were involved in the evolution of this language, adding features and increasing its popularity. This new scripting language allowed the developers to improve the customer experience and application performance and, in a short time, there began to appear the first JavaScript frameworks that made JavaScript the new rock star of web development.

All this sounds great, but, was it always as awesome as the strong language we have today? Uhmm, no it was not. The first JavaScript version was created by Brendan Eich in 1995 for the Netscape Navigator, named in those times as Mocha, then LiveScript, and finally, JavaScript.

Let's explore more about the features of this powerful language and how it becomes one of the most used for application development.

In this chapter, we will walk through the following topics:

JavaScript fundamentals

The ECMAScript standard

Setting up our environment

The Aurelia framework

The Aurelia command line

Overview of the example app

JavaScript fundamentals

JavaScript is a programming language used to add custom behavior to your web page by executing code in your web browser side (commonly named client side). So, this allows us to create rich dynamic projects such as games, execute custom code in response to events when the user presses some button, apply dynamic effects to our web page elements, form data validation, and so on.

JavaScript as a single language is very flexible, and there is a big community of developers writing and unlocking additional functionality, big companies working on new libraries and of course, we as empowered developers ready to get all these features and make the web awesome.

There are a few basic characteristics of JavaScript:

Dynamic typing

Object oriented

Functional

Prototyped

Event handling

Functional

A function is an object inside itself. They have properties, methods, and can include inner functions. It's a way to encapsulate a functionality you want to reuse in more than one place in your application; you just need to write the function name instead of all the code inside that, just like the following example:

function

sum

(numberA, numberB){

return

numberA + numberB}

sum

(

4

,

5

)

//9

sum

(

5

,

2

)

//7

sum

(

sum

(

5

,

1

),

9

)

//15

The ECMAScript standard

In the beginning, some companies such as Microsoft were trying to develop their own JavaScript implementation, in this case, JScript for Internet Explorer 3.0, in the year  1996.To define a standard, Netscape delivered JavaScript to the European Computer Manufacturers Association (ECMA), a standards organization for information and communication systems.

The first edition of ECMA-262 was adopted by the ECMA General Assembly in June 1997. Several editions of the language standard have been published since then. The name ECMAScript was a compromise between the organizations involved in standardizing the language, especially Netscape and Microsoft, whose disputes dominated the early standards sessions.

So, after all these standardization processes and paperwork, what are we using? ECMAScript, JScript, ActionScript, or JavaScript? Are they the same? Well, basically no. After the standardization, ECMAScript was defined as the main language, and JavaScript, JScript, and ActionScript are dialects of this language, of course, JavaScript being the most known and used.

The ECMAScript Version 5 is supported by most browsers nowadays, released in 2011. Some of the features managed for this version are as listed:

Support for new Array methods

Support for manage dates

Support for JSON

At this point, we’ve seen pure ES5 syntax, very verbose, sometimes highly coupled with other functionality, and if we are planning to develop a big application, it can become difficult to maintain.

Thank God we won’t have to deal with this syntax anymore. The ECMAScript 6 (ES6) version came with a lot of changes that simplify the development and understanding of our code.

Setting up our environment

At this point, we are ready to start writing our first functions and methods in JavaScript language. We know how to deal with the new ES6 syntax and how we can use all these new features to improve our application. Let's set up our environment and install Node.js.

Installing Node.js

The first thing you need to do to start using NPM is download Node.js. Node is an asynchronous event-driven JavaScript runtime. It is not a new language or a new syntax; it's just the platform where you can write JavaScript code outside the browser and Node.js will use the power of Google's V8 JavaScript Engine to execute it.

If you're using OS X or Windows, the best way to install Node.js is to use one of the installers from theNode.js download page.

If you're using Linux, you can use your package manager or check the download page to see whether there's a more recent version that works with your system.

To check whether you have a previous version installed, run the following command:

$ node –v

The Node Package Manager

The Node Package Manager (NPM) is a complete tool created to help developers share, maintain, and reuse JavaScript code bundled in packages with other developers to reuse it on their own applications. NPM is made up of three distinct components:

The NPM website

The NPM registry

The NPM command-line tool

NPM website

This website serves as the primary tool for users to discover packages; you’ll find something like this:

This page describes all the features of the package you want to download, a brief documentation about it, the GitHub URL, and instructions to import them into your project.

NPM Registry

It is a large database of information about each package.The official public NPM registry is athttps://registry.npmjs.org/. It is powered by a CouchDB database, of which there is a public mirror athttps://skimdb.npmjs.com/registry.

NPM CLI

A command-line tool for interacting with the registry and allowing the developers to publish or download packages.

Once you have the code downloaded on your machine, NPM will make it very easy to check whether there is an update available and download those changes when they’re made. More than two bits of reusable code is called a package. That’s just a directory with one or more files in it, along with a file calledpackage.json, which contains all the metadata about that package.

Common NPM operations

Like all the command-line tools, it is important to understand the options provided by NPM. The NPM CLI is a powerful tool that will help us in the development cycle of our project.