舉報

會員
Learning Node.js Development
Andrew Mead 著
更新時間:2021-06-30 18:57:56
開會員,本書免費讀 >
ThisbooktargetsanyonelookingtolaunchtheirownNodeapplications,switchcareers,orfreelanceasaNodedeveloper.YoushouldhaveabasicunderstandingofJavaScriptinordertofollowthiscourse.
最新章節
- Leave a review - let other readers know what you think
- Another Book You May Enjoy
- Conclusion
- Summary
- Writing a test to verify swapping of the function
- Replacing db with the spy
品牌:中圖公司
上架時間:2021-06-30 18:28:45
出版社:Packt Publishing
本書數字版權由中圖公司提供,并由其授權上海閱文信息技術有限公司制作發行
- Leave a review - let other readers know what you think 更新時間:2021-06-30 18:57:56
- Another Book You May Enjoy
- Conclusion
- Summary
- Writing a test to verify swapping of the function
- Replacing db with the spy
- Installing and setting up the rewire function
- Swapping of the function with spy
- More details out of spy assertion
- Setting up spies assertions
- Creating a spy
- Creating a test file for spies
- Test spies
- Adding the route describe block for the server.test.js file
- Adding describe() for individual methods
- Organizing test with describe()
- Writing the test for the express route
- Creating an express route
- Adding flexibility to SuperTest
- Setting up custom status
- Testing our first API request
- Writing the test for the Express app
- Creating a test for the Express app
- The SuperTest documentation
- Testing the Express app using SuperTest
- Setting up testing for the Express app
- Testing the Express application
- Testing the Node Applications – Part 2
- Summary
- Making assertions for the asyncSquare function
- Writing test for asyncSquare
- Creating the async square function
- The asynchronous testing for the square function
- Adding the done argument
- Making assertion for the asyncAdd function
- Writing the test for the asyncAdd function
- Creating the asyncAdd function using the setTimeout object
- The asynchronous testing
- Testing the setName method
- Using toInclude and toExclude
- Using the toEqual and toNotEqual assertions
- Using toBe and toNotBe to compare array/objects
- Exploring usage of expect with bogus test
- Multiple assertions for the square function
- Chaining multiple assertions
- Exploring assertion libraries
- Using assertion libraries in testing Node modules
- Autorestarting the tests
- Testing the squaring a number function
- Creating the if condition for the test
- Creating a test file for the add function
- Mocha – the testing framework
- Testing a Node project
- Installing the testing module
- Basic testing
- Testing the Node Applications – Part 1
- Summary
- Running the Heroku create command
- Making a commit in Heroku
- Changes in the package.json file
- Changes in the server.js file
- Setting up in the application code for Heroku
- Getting SSH key to Heroku
- Log in to Heroku account locally
- Installing Heroku command-line tools
- Deploying the node app to the Web
- Setting up the repository
- Creating a new repository
- Testing the configuration
- Configuring GitHub
- Starting up the SSH agent
- Generating a key
- Working on commands
- SSH keys documentations
- Setting up SSH keys
- Setting up GitHub and SSH keys
- Making a commit
- Adding untracked files to commit
- Using Git
- Turning the node-web-server directory into a Git repository
- Testing the installation
- Git on Windows
- Git on macOS
- Installing Git
- Adding version control
- Deploying Applications to Web
- Summary
- Testing the maintenance middleware
- The maintenance middleware without the next object
- Printing message to file
- Creating a logger
- Exploring middleware
- Express Middleware
- Arguments in Helper
- The Handlebars helper
- The Header partial
- Working of partial
- Adding partials
- Advanced templates
- Rendering the template for the root of the website
- Injecting data inside of templates
- Getting the static page for rendering
- Our first template
- Configuring handlebars
- Installing the hbs module
- Rendering templates
- The call to app.listen
- Serving the HTML page in the Express app
- The body tag
- The head tag
- Making an HTML page
- The static server
- Error handling in the JSON request
- Sending JSON data back
- Passing HTML to res.send
- Exploring the developer tools in the browser for the app request
- Creating an app
- Installing Express
- Express docs website
- Configuring Express
- Introducing Express
- Web Servers in Node
- Summary
- Chaining the promise calls
- Generating the weather URL
- Error handling with ZERO_RESULT body status
- Error handling in axios request
- Making axios request
- Making calls in the app-promise file
- Installing axios
- Axios documentations
- Fetching weather app code from the app.js file
- Weather app with promises
- Testing the request library
- The request library in promises
- The catch method
- Error handling in promises chaining
- Promise chaining
- Returning the promises
- Providing input to promises
- Advanced promises
- Merits of promises
- Error handling in promises
- Running the promise example in Terminal
- Calling the promise method then
- Creating an example promise
- Introduction to ES6 promises
- Promises in Asynchronous Programming
- Summary
- Testing the chaining of callbacks
- Replacing static coordinates with dynamic coordinates
- Moving getWeather call into geocodeAddress function
- Chaining the geocodeAddress and getWeather callbacks together
- Changing console.log calls into callback calls
- Adding dynamic latitude and longitude
- Implementing getWeather callback inside weather.js file
- Printing errorMessage in the getWeather function
- Passing the arguments in the getWeather function
- Providing weather directory in app.js
- Defining the new function getWeather in weather file
- Refactoring our request call in weather.js file
- Chaining callbacks together
- Testing the error handling in callback
- Another way of error handling
- Error handling in the the callback function
- Making a request for the weather app using the static URL
- Exploring the actual URL for code
- Exploring working of API in the browser
- Wiring up weather search
- Testing the callback function in geocode.js file
- Implementing the callback function in geocode.js file
- Setting up the function in geocodeAddress function in app.js
- Adding callback function to geocodeAddress
- Creating geocode file
- Working on request statement
- Refactoring app.js and code into geocode.js file
- Abstracting callbacks
- Testing the body status property
- Adding if else statement to check body status property
- Adding the if statement for callback errors
- Checking error in Google API request
- Callback errors
- Pulling the address out of argv
- Decoding URI component
- Encoding URI component
- Encoding and decoding the strings
- Printing the address to screen
- Configuring yargs
- Installing yargs
- Encoding user input
- Callbacks in Asynchronous Programming
- Summary
- Printing latitude and longitude
- Printing the formatted address
- Printing data from the body object
- The error argument
- The response object
- Making up of the HTTPS requests
- Using the body argument
- Pretty printing objects
- Running the request
- Using request as a function
- Installing the request package
- Using Google Maps API data in our code
- Making request to Geolocation API
- Simulating delay using setTimeout
- Running the callback function
- Creating the callback function
- The callback function
- Callback functions and APIs
- Running the async code
- The event loop
- The callback queue in async programming
- The Node API in async programming
- An async program example
- A complex synchronous program example
- Running the synchronous program
- The call stack
- A synchronous program example
- Call stack and event loop
- Illustrating the async programming model
- The basic concept of asynchronous program
- Basics of Asynchronous Programming in Node.js
- Summary
- Exploring the arguments array
- Exploring the difference between regular and arrow functions
- Using the arrow function
- Arrow functions
- Testing the remove command
- Adding the titleOption and bodyOption variables
- Adding support to the read and remove commands
- Adding the body
- Adding the title
- Adding the options object
- Calling the .help command
- Using chaining syntax on yargs
- Advanced yargs
- Using the getAll function
- Listing notes
- Using debugger inside the notes application
- Working with debugging
- Executing a program in debug mode
- Debugging
- Using the logNote function
- The DRY principle
- Running the getNote function
- Using the getNote function
- Reading note
- Printing a message of removing notes
- Using the removeNote function
- Removing a note
- Node Fundamentals – Part 3
- Summary
- Testing the functionality
- Working with saveNotes
- Working with fetchNotes
- Moving functionality into individual functions
- Refactoring
- Making the title unique
- Trying and catching code block
- Fetching new notes
- Adding notes to the notes array
- Adding notes
- Adding and saving notes
- Reading out the content in the file
- Writing the file in the playground folder
- Storing the string in a file
- Converting a string back to an object
- Defining a string and using in app as an object
- Converting objects into strings
- JSON
- Fetching command
- The remove command
- Dealing with the errors in parsing commands
- The read command
- Working with the list command
- Working with the add command
- Running yargs
- Installing yargs
- yargs
- Node Fundamentals – Part 2
- Summary
- Getting the specific note information
- Solution to the exercise
- Exercise – adding two else if clauses to an if block
- Adding if/else statements
- Accessing the command-line argument for the notes application
- Getting input from the user inside the command line
- Getting input
- Executing nodemon
- Installing the nodemon module
- Global modules
- The node_modules folder
- Using _.uniq
- Using the _.isString utility
- Using the utilities of lodash
- Installation of lodash
- Installing the lodash module in our app
- Creating projects using npm modules
- Third-party modules
- Solution to the exercise
- Exercise – adding a new function to the export object
- Exporting the functions
- A simple example of the working of the exports object
- Exporting files from note.js to use in app.js
- Making a new file to load other files
- Require own files
- Using template strings
- Concatenating user.username
- The OS module in require()
- Creating and appending files in the File System module
- The built-in module to use require()
- Initialization of an application
- Using case for require()
- Module basics
- Node Fundamentals – Part 1
- Summary
- Running the Node application
- Creating the Node application
- Hello World – creating and running the first Node app
- Different text editors for node applications
- Node community – problem solving open source libraries
- Blocking and non-blocking examples using Terminal
- The working non-blocking I/O
- The working of blocking I/O
- Blocking and non-blocking software development
- Why use Node
- Differences between JavaScript coding using Node and in the browser
- What is Node?
- Verifying installation
- Installing Node
- Node.js version confirmation
- Node.js installation
- Getting Set Up
- Reviews
- Get in touch
- Conventions used
- Download the example code files
- To get the most out of this book
- What this book covers
- Who this book is for
- Preface
- Packt is searching for authors like you
- About the author
- Contributor
- PacktPub.com
- Why subscribe?
- Packt Upsell
- Title Page
- coverpage
- coverpage
- Title Page
- Packt Upsell
- Why subscribe?
- PacktPub.com
- Contributor
- About the author
- 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
- Getting Set Up
- Node.js installation
- Node.js version confirmation
- Installing Node
- Verifying installation
- What is Node?
- Differences between JavaScript coding using Node and in the browser
- Why use Node
- Blocking and non-blocking software development
- The working of blocking I/O
- The working non-blocking I/O
- Blocking and non-blocking examples using Terminal
- Node community – problem solving open source libraries
- Different text editors for node applications
- Hello World – creating and running the first Node app
- Creating the Node application
- Running the Node application
- Summary
- Node Fundamentals – Part 1
- Module basics
- Using case for require()
- Initialization of an application
- The built-in module to use require()
- Creating and appending files in the File System module
- The OS module in require()
- Concatenating user.username
- Using template strings
- Require own files
- Making a new file to load other files
- Exporting files from note.js to use in app.js
- A simple example of the working of the exports object
- Exporting the functions
- Exercise – adding a new function to the export object
- Solution to the exercise
- Third-party modules
- Creating projects using npm modules
- Installing the lodash module in our app
- Installation of lodash
- Using the utilities of lodash
- Using the _.isString utility
- Using _.uniq
- The node_modules folder
- Global modules
- Installing the nodemon module
- Executing nodemon
- Getting input
- Getting input from the user inside the command line
- Accessing the command-line argument for the notes application
- Adding if/else statements
- Exercise – adding two else if clauses to an if block
- Solution to the exercise
- Getting the specific note information
- Summary
- Node Fundamentals – Part 2
- yargs
- Installing yargs
- Running yargs
- Working with the add command
- Working with the list command
- The read command
- Dealing with the errors in parsing commands
- The remove command
- Fetching command
- JSON
- Converting objects into strings
- Defining a string and using in app as an object
- Converting a string back to an object
- Storing the string in a file
- Writing the file in the playground folder
- Reading out the content in the file
- Adding and saving notes
- Adding notes
- Adding notes to the notes array
- Fetching new notes
- Trying and catching code block
- Making the title unique
- Refactoring
- Moving functionality into individual functions
- Working with fetchNotes
- Working with saveNotes
- Testing the functionality
- Summary
- Node Fundamentals – Part 3
- Removing a note
- Using the removeNote function
- Printing a message of removing notes
- Reading note
- Using the getNote function
- Running the getNote function
- The DRY principle
- Using the logNote function
- Debugging
- Executing a program in debug mode
- Working with debugging
- Using debugger inside the notes application
- Listing notes
- Using the getAll function
- Advanced yargs
- Using chaining syntax on yargs
- Calling the .help command
- Adding the options object
- Adding the title
- Adding the body
- Adding support to the read and remove commands
- Adding the titleOption and bodyOption variables
- Testing the remove command
- Arrow functions
- Using the arrow function
- Exploring the difference between regular and arrow functions
- Exploring the arguments array
- Summary
- Basics of Asynchronous Programming in Node.js
- The basic concept of asynchronous program
- Illustrating the async programming model
- Call stack and event loop
- A synchronous program example
- The call stack
- Running the synchronous program
- A complex synchronous program example
- An async program example
- The Node API in async programming
- The callback queue in async programming
- The event loop
- Running the async code
- Callback functions and APIs
- The callback function
- Creating the callback function
- Running the callback function
- Simulating delay using setTimeout
- Making request to Geolocation API
- Using Google Maps API data in our code
- Installing the request package
- Using request as a function
- Running the request
- Pretty printing objects
- Using the body argument
- Making up of the HTTPS requests
- The response object
- The error argument
- Printing data from the body object
- Printing the formatted address
- Printing latitude and longitude
- Summary
- Callbacks in Asynchronous Programming
- Encoding user input
- Installing yargs
- Configuring yargs
- Printing the address to screen
- Encoding and decoding the strings
- Encoding URI component
- Decoding URI component
- Pulling the address out of argv
- Callback errors
- Checking error in Google API request
- Adding the if statement for callback errors
- Adding if else statement to check body status property
- Testing the body status property
- Abstracting callbacks
- Refactoring app.js and code into geocode.js file
- Working on request statement
- Creating geocode file
- Adding callback function to geocodeAddress
- Setting up the function in geocodeAddress function in app.js
- Implementing the callback function in geocode.js file
- Testing the callback function in geocode.js file
- Wiring up weather search
- Exploring working of API in the browser
- Exploring the actual URL for code
- Making a request for the weather app using the static URL
- Error handling in the the callback function
- Another way of error handling
- Testing the error handling in callback
- Chaining callbacks together
- Refactoring our request call in weather.js file
- Defining the new function getWeather in weather file
- Providing weather directory in app.js
- Passing the arguments in the getWeather function
- Printing errorMessage in the getWeather function
- Implementing getWeather callback inside weather.js file
- Adding dynamic latitude and longitude
- Changing console.log calls into callback calls
- Chaining the geocodeAddress and getWeather callbacks together
- Moving getWeather call into geocodeAddress function
- Replacing static coordinates with dynamic coordinates
- Testing the chaining of callbacks
- Summary
- Promises in Asynchronous Programming
- Introduction to ES6 promises
- Creating an example promise
- Calling the promise method then
- Running the promise example in Terminal
- Error handling in promises
- Merits of promises
- Advanced promises
- Providing input to promises
- Returning the promises
- Promise chaining
- Error handling in promises chaining
- The catch method
- The request library in promises
- Testing the request library
- Weather app with promises
- Fetching weather app code from the app.js file
- Axios documentations
- Installing axios
- Making calls in the app-promise file
- Making axios request
- Error handling in axios request
- Error handling with ZERO_RESULT body status
- Generating the weather URL
- Chaining the promise calls
- Summary
- Web Servers in Node
- Introducing Express
- Configuring Express
- Express docs website
- Installing Express
- Creating an app
- Exploring the developer tools in the browser for the app request
- Passing HTML to res.send
- Sending JSON data back
- Error handling in the JSON request
- The static server
- Making an HTML page
- The head tag
- The body tag
- Serving the HTML page in the Express app
- The call to app.listen
- Rendering templates
- Installing the hbs module
- Configuring handlebars
- Our first template
- Getting the static page for rendering
- Injecting data inside of templates
- Rendering the template for the root of the website
- Advanced templates
- Adding partials
- Working of partial
- The Header partial
- The Handlebars helper
- Arguments in Helper
- Express Middleware
- Exploring middleware
- Creating a logger
- Printing message to file
- The maintenance middleware without the next object
- Testing the maintenance middleware
- Summary
- Deploying Applications to Web
- Adding version control
- Installing Git
- Git on macOS
- Git on Windows
- Testing the installation
- Turning the node-web-server directory into a Git repository
- Using Git
- Adding untracked files to commit
- Making a commit
- Setting up GitHub and SSH keys
- Setting up SSH keys
- SSH keys documentations
- Working on commands
- Generating a key
- Starting up the SSH agent
- Configuring GitHub
- Testing the configuration
- Creating a new repository
- Setting up the repository
- Deploying the node app to the Web
- Installing Heroku command-line tools
- Log in to Heroku account locally
- Getting SSH key to Heroku
- Setting up in the application code for Heroku
- Changes in the server.js file
- Changes in the package.json file
- Making a commit in Heroku
- Running the Heroku create command
- Summary
- Testing the Node Applications – Part 1
- Basic testing
- Installing the testing module
- Testing a Node project
- Mocha – the testing framework
- Creating a test file for the add function
- Creating the if condition for the test
- Testing the squaring a number function
- Autorestarting the tests
- Using assertion libraries in testing Node modules
- Exploring assertion libraries
- Chaining multiple assertions
- Multiple assertions for the square function
- Exploring usage of expect with bogus test
- Using toBe and toNotBe to compare array/objects
- Using the toEqual and toNotEqual assertions
- Using toInclude and toExclude
- Testing the setName method
- The asynchronous testing
- Creating the asyncAdd function using the setTimeout object
- Writing the test for the asyncAdd function
- Making assertion for the asyncAdd function
- Adding the done argument
- The asynchronous testing for the square function
- Creating the async square function
- Writing test for asyncSquare
- Making assertions for the asyncSquare function
- Summary
- Testing the Node Applications – Part 2
- Testing the Express application
- Setting up testing for the Express app
- Testing the Express app using SuperTest
- The SuperTest documentation
- Creating a test for the Express app
- Writing the test for the Express app
- Testing our first API request
- Setting up custom status
- Adding flexibility to SuperTest
- Creating an express route
- Writing the test for the express route
- Organizing test with describe()
- Adding describe() for individual methods
- Adding the route describe block for the server.test.js file
- Test spies
- Creating a test file for spies
- Creating a spy
- Setting up spies assertions
- More details out of spy assertion
- Swapping of the function with spy
- Installing and setting up the rewire function
- Replacing db with the spy
- Writing a test to verify swapping of the function
- Summary
- Conclusion
- Another Book You May Enjoy
- Leave a review - let other readers know what you think 更新時間:2021-06-30 18:57:56