JavaScript from Frontend to Backend

Book description

Delve into the world of web development with Vue.js, Node.js, and MongoDB by exploring essential JavaScript concepts on the client side and the server side

Key Features

  • Get up and running with JavaScript, the most popular web development language in the world
  • Cut through the complexity and focus on the simple aspects of web development
  • Build a simple web application using Vue.js, Node.js, and MongoDB

Book Description

JavaScript, the most widely used programming language in the world, has numerous libraries and modules and a dizzying array of need-to-know topics. Picking a starting point can be difficult. Enter JavaScript from Frontend to Backend. This concise, practical guide will get you up to speed in next to no time.

This book begins with the basics of variables and objects in JavaScript and then moves quickly on to building components on the client-side with Vue.js and a simple list management application. After that, the focus shifts to the server-side and Node.js, where you'll examine the MVC model and explore the Express module. Once you've got to grips with the server-side and the client-side, the only thing that remains is the database. You'll discover MongoDB and the Mongoose module. In the final chapter of this fast-paced guide, you'll combine all these pieces to integrate a Vue.js application into a Node.js server, using Express to structure the server code and MongoDB to store the information.

By the end of this book, you will have the skills and confidence to successfully implement JavaScript concepts in your own projects and begin your career as a JavaScript developer.

What you will learn

  • Trigger deferred processing with JavaScript
  • Implement Express and MongoDB with Node.js
  • Build components with Vue.js
  • Understand how to create and use modules with Node.js
  • Familiarize yourself with npm
  • Build a client-side application entirely with JavaScript
  • Dive into full stack development with Vue.js, Node.js, and MongoDB

Who this book is for

This book is for JavaScript developers looking to strengthen their core JavaScript concepts and implement them in building full stack apps. Prior knowledge of HTML and CSS is a must.

Table of contents

  1. JavaScript from Frontend to Backend
  2. Contributors
  3. About the author
  4. About the reviewer
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Share Your Thoughts
  6. Part 1: JavaScript Syntax
  7. Chapter 1: Exploring the Core Concepts of JavaScript
    1. Technical requirements
    2. Types of variables used in JavaScript
      1. Numerical values
      2. Boolean values
      3. Character strings
      4. Arrays
      5. Objects
    3. Running a JavaScript program
      1. Running a JavaScript program in a browser
      2. Running a JavaScript program on a Node.js server
      3. Differences between JavaScript code written for the browser and the server
    4. Declaring variables in JavaScript
      1. Using the const keyword
      2. Using the var keyword
      3. Using the let keyword
      4. What if we don’t use var or let to define a variable?
      5. What is an uninitialized variable worth?
    5. Writing conditions for conditional tests
      1. Forms of writing instructions
      2. Expressions used to write conditions
      3. Nested test suites
    6. Creating processing loops
      1. Loops with while()
      2. Loops with for()
    7. Using functions
      1. Function displaying the list of the first 10 integers
      2. Function calculating the sum of the first 10 integers
      3. Function calculating the sum of the first N integers
    8. Summary
  8. Chapter 2: Exploring the Advanced Concepts of JavaScript
    1. Technical requirements
    2. Classes and objects
      1. Defining a class
      2. Creating an object by using a class
      3. Creating an object without using a class
      4. Adding properties to a class
      5. Adding methods to a class
      6. Changing an object’s property values
      7. Using the class constructor
      8. Merging one object with another
    3. Arrays
      1. Creating an array
      2. Accessing array elements
      3. Adding items to the array
      4. Deleting array elements
      5. Filtering elements in an array
    4. Character strings
      1. Creating a character string
      2. Accessing characters in a string
      3. Modifying a character string
      4. Using regular expressions
    5. Multitasking in JavaScript
      1. Using the setTimeout() function
      2. Using the setInterval() function
      3. Using the clearInterval() function
    6. Using promises
  9. Part 2: JavaScript on the Client-Side
  10. Chapter 3: Getting Started with Vue.js
    1. Technical requirements
    2. Using Vue.js in an HTML page
    3. Creating our first Vue.js application
    4. Using reactivity
    5. Creating our first component
      1. Inserting a component in the application file
      2. Inserting a component from an external file
    6. Adding methods in components
      1. Defining methods in the methods section
      2. Defining computed properties in the computed section
    7. Using attributes in components
    8. Using directives
      1. The v-if and v-else directives
      2. The v-show directive
      3. The v-for directive
      4. The v-model directive
    9. Summary
  11. Chapter 4: Advanced Concepts of Vue.js
    1. Technical requirements
    2. Managing events
    3. Using the $event parameter
      1. Checking that the entered value is less than 100
      2. Allowing only digits to be entered
    4. Assembling components
      1. Using $emit() to communicate with a parent component
      2. Using props to communicate with children
    5. Using visual effects
      1. When the element appears
      2. When the element disappears
    6. Using a name for the effect
    7. Producing an effect on several elements
    8. Examples of commonly used effects
      1. The shrink effect
      2. The opacity effect
      3. The move-down effect
    9. Summary
  12. Chapter 5: Managing a List with Vue.js
    1. Technical requirements
    2. Displaying application screens
    3. Splitting the application into components
    4. Adding an element to the list
      1. Using the <Element> component
      2. Changing the appearance of the list using CSS code
    5. Removing an element from the list
    6. Modifying an element in the list
      1. Transforming the <span> element into an <input> element
      2. Exiting from the input field
      3. Giving focus to the input field
    7. Summary
  13. Part 3: JavaScript on the Server-Side
  14. Chapter 6: Creating and Using Node.js Modules
    1. Technical requirements
    2. Creating and using our own modules
      1. Creating a module
      2. Using the node_modules directory
      3. Using the package.json file
      4. Adding functionalities to the module
    3. Using internal Node.js modules
      1. Reading the contents of a file
      2. Displaying file contents as strings
      3. Using non-blocking file reading
    4. Using downloaded modules with npm
      1. Using the npm command
      2. Using a downloaded module with npm
    5. Summary
  15. Chapter 7: Using Express with Node.js
    1. Technical requirements
    2. Using the Node.js http module
    3. Installing the Express module
    4. The MVC pattern used by Express
    5. Using routes with Express
      1. The initial content of the app.js file
      2. Different types of routes possible
      3. Analyzing routes defined in the app.js file
      4. Adding a new route in the app.js file
    6. Displaying views with Express
    7. Summary
  16. Chapter 8: Using MongoDB with Node.js
    1. Technical requirements
    2. Installing MongoDB
      1. Using the mongo utility
      2. Installing the mongoose module
    3. Connecting to the MongoDB database
    4. Creating documents in MongoDB
      1. Describing document structure using schemas and models
      2. Creating the document
    5. Searching for documents in MongoDB
      1. Writing search conditions
      2. Retrieving and displaying the results
    6. Updating documents in MongoDB
    7. Deleting documents in MongoDB
    8. Summary
  17. Chapter 9: Integrating Vue.js with Node.js
    1. Technical requirements
    2. Displaying application screens
    3. Building the app with Express
    4. MongoDB database structure
    5. Installing the Axios library
    6. Inserting a new element in the list
      1. Replacing the text and index attributes with the element attribute
      2. Description of the Axios library for communicating between the client and the server
      3. Using Axios with a POST type request (client side)
      4. POST type request processing (server side)
      5. Verifying the correct operation of the insertion in the database
    7. Displaying list elements
      1. Using Axios with a GET type request (client side)
      2. GET type request processing (server side)
    8. Modifying an element in the list
      1. Using Axios with a PUT type request (client side)
      2. PUT type request processing (server side)
    9. Removing an element from the list
      1. Using Axios with a DELETE type request (client side)
      2. DELETE type request processing (server side)
    10. Summary
    11. Thanks
    12. Why subscribe?
  18. Other Books You May Enjoy
    1. Packt is searching for authors like you

Product information

  • Title: JavaScript from Frontend to Backend
  • Author(s): Eric Sarrion
  • Release date: July 2022
  • Publisher(s): Packt Publishing
  • ISBN: 9781801070317