12,66 €
Learn everything you need to get up and running with cutting-edge API development using JavaScript and Node.js; ideal for data-intensive real-time applications that run across multiple platforms.
Key Features
Book Description
Using the same framework to build both server and client-side applications saves you time and money. This book teaches you how you can use JavaScript and Node.js to build highly scalable APIs that work well with lightweight cross-platform client applications. It begins with the basics of Node.js in the context of backend development, and quickly leads you through the creation of an example client that pairs up with a fully authenticated API implementation. By the end of the book, you'll have the skills and exposure required to get hands-on with your own API development project.
What you will learn
Who this book is for
This book is ideal for developers who already understand JavaScript and are looking for a quick no-frills introduction to API development with Node.js. Though prior experience with other server-side technologies such as Python, PHP, ASP.NET, Ruby will help, it's not essential to have a background in backend development before getting started.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 75
Veröffentlichungsjahr: 2018
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 author, 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.
Acquisitions Editor: Koushik SenContent Development Editors: Tanmayee Patil, Rutuja YerunkarProduction Coordinator: Ratan Pote
First published: July 2018
Production reference: 1230718
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78953-966-0
www.packtpub.com
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.
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
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.
Anthony Nandaa is a senior software developer with more than 7 years of professional programming experience. He was introduced to programming 3 years before his career as a developer began, working with Pascal and VB 6. In his career so far, he has worked with multiple languages, such as Python, PHP, Go, and full-stack JavaScript.
In his current role, he leads a team of engineers working with Node.js and React for frontend development. He considers himself a lifelong learner, and lately, he has been learning Haskell for fun and to gain some insight into pure functional programming.
Sam Anderson is an electronic engineer turned developer currently working for an award-winning creative digital agency based in Sheffield, England. Having moved from the world of hardware design, he is passionate about creating fast, beautiful, and efficient frontend applications. You can follow him on Twitter at @andomain.
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.
Title Page
Copyright and Credits
Beginning API Development with Node.js
Packt Upsell
Why Subscribe?
PacktPub.com
Contributors
About the Author
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
Introduction to Node.js
The Basics of Node.js
Applications of Node.js
Activity: Running Basic Node.js Code
The Module System
Application Modularization
Module Categories
Built-In Modules
npm – Third-Party Module Registry
Scanning for node_modules
Handy npm Commands
Local Modules
Activity: Using a Third-Party Package for the Previous math.js Code
Asynchronous Programming with Node.js
Callbacks
Promises
Async/Await
Activity: Transforming a Text File Using an Async Function
Summary
Building the API - Part 1
Building a Basic HTTP Server
Setting up Hapi.js
Exercise 1: Building a Basic Hapi.js Server
Using an API Client
Returning JSON Strings
Exercise 2: Returning JSON
Using nodemon for Development Workflow
Exercise 3: Using nodemon
Setting up the Logger
Exercise 4: Setting up the Logger
Understanding Requests
A Look at HTTP Request Methods
Exercise 5: Getting a List of Resources
Exercise 6: Getting a Specific Resource
Exercise 7: Creating a New Todo with POST
Exercise 8: Updating a Resource with PUT
Exercise 9: Updating with PATCH
Exercise 10: Deleting a Resource with DELETE
Request Validation
Exercise 11: Validating a Request
Summary
Building the API - Part 2
Working with the DB Using Knex.js
Exercise 12: Setting up the Database
Exercise 13: Connecting to the Database
Exercise 14: Creating a Record
Exercise 15: Reading from the Database
Exercise 16: Updating a Record
Exercise 17: Deleting a Record
Exercise 18: Cleaning up the Code
Authenticating Your API with JWT
Exercise 19: Securing All the Routes
Exercise 20: Adding User Authentication
Authentication versus Authorization
Exercise 21: Implementing Authorization
Testing Your API with Lab
Exercise 22: Writing Basic Tests with Lab
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
Using the same framework to build both server and client-side applications saves you time and money. This book teaches you how you can use JavaScript and Node.js to build highly scalable APIs that work well with lightweight cross-platform client applications. It begins with the basics of Node.js in the context of backend development, and quickly leads you through the creation of an example client that pairs up with a fully authenticated API implementation.
This book balances theory and exercises, and contains multiple open-ended activities that use real-life business scenarios for you to practice and apply your newly acquired skills in a highly relevant context.
We have included over 20 practical activities and exercises across 9 topics to reinforce your learning. By the end of this book, you'll have the skills and exposure required to get hands-on with your own API development project.
This book is ideal for developers who already understand JavaScript and are looking for a quick no-frills introduction to API development with Node.js. Though prior experience with other server-side technologies such as Python, PHP, ASP.NET, Ruby will help, it's not essential to have a background in backend development before getting started.
Chapter 1, Introduction to Node.js, covers a few fundamental concepts in Node.js, basic Node.js code and run it from the Terminal, module system, its categories, and asynchronous programming model that is at the heart of how Node.js works, and what actually makes Node.js tick.
Chapter 2, Building the API – Part 1, covers building a basic HTTP server, setting up Hapi.js, building basic API with Hapi.js Framework, and fundamental concepts of web applications.
Chapter 3, Building the API – Part 2, covers introduction to Knex.js and how we can use it to connect and use the database, essential CRUD database methods, API authentication using the JWT mechanism, CORS mechanism, testing the API using Lab library, and test automation using Gulp.js.
Prior experience with other server-side technologies, such as Python, PHP, ASP.NET, and Ruby will be beneficial but is not mandatory.
This book will require a computer system. The minimum hardware requirements are 1.8 GHz or higher Pentium 4 (or equivalent) processor, 4 GB RAM, 10 GB hard disk, and a stable internet connection.
The software required are Visual Studio Code (
https://code.visualstudio.com/
), Node.js (8.9.1) (
https://nodejs.org/en/
), MySQL Workbench 6.3 (
https://www.mysql.com/products/workbench/
), and MySQL (
https://dev.mysql.com/downloads/mysql/
).
You can download the example code files for this book from your account at www.packtpub.com
