RESTful Web API Design with Node.js - Second Edition
Copyright 2016 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, and its dealers and distributors will be held liable for any damages caused or alleged to be 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.
First published: March 2015
Second edition: May 2016
Production reference: 1200516
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B32PB, UK.
ISBN 978-1-78646-913-7
www.packtpub.com
Credits
Author Valentin Bojinov | Copy Editor Charlotte Carneiro |
Reviewer Huseyin BABAL | Project Coordinator Sanchita Mandal |
Commissioning Editor Amarabha Banerjee | Proofreader Safis Editing |
Acquisition Editor Reshma Raman | Indexer Hemangini Bari |
Content Development Editor Shali Deeraj | Production Coordinator Melwyn D'sa |
Technical Editor Prajakta Mhatre | Cover Work Melwyn D'sa |
About the Author
Valentin Bojinov studied computer programming at the Technological School of Electronic Systems in Sofia, Bulgaria, a college within the Technical University of Sofia. He was introduced to programming there and realized that his career would be in research and development. He holds a BSc in telecommunication and information engineering. Then, his interest in data transmission grew, and he ventured into B2B (business-to-business) communication. He is currently pursuing his MSc in software development. Valentin is an expert in Java, SOAP, RESTful web services, and B2B integration.
A few years after he started his career as a .NET developer, he realized that B2B and SOA were his passion. He then moved to SAP, where he contributed to the development of the web services stack of the SAP JEE platform. He currently works as a senior Java developer for the Bulgarian branch of Seeburger AG, a leader in the B2B and MFT solutions market. There, he develops and maintains several B2B communication adapters, including web services and SAP adapters.
I would like to take the opportunity to thank my soulmate Galya for putting up with me and with my decision to work on this title. Also, many thanks to my lovely parents, my dad Emil for encouraging me to study computers 20 years ago, and to mummy Anka for always being there for me! Special thanks to all my mentors from TUES for showing me how to learn efficiently and to never give up, the credit here goes mainly to Lubomir Chorbadjiev. I also have to mention my extraordinary colleagues I had the chance to study with! Guys, thanks for always being such good friends and experts! I know I havent recently shown on our regular monthly gathering, so next time beer is on me!
About the Reviewer
Huseyin BABAL is an enthusiast full stack developer since 2007 who mainly develops web applications by using Java, Node.js and PHP on the backend; AngularJS and Twitter Bootstrap on the frontend; and Elasticsearch and MongoDB for some research projects. He is the author of Node.js in Action on Udemy with 1500+ students. He is also interested in DevOps engineering and applies continuous delivery principles to his projects. He writes tutorials about full stack development on Tuts+ and Java Code Geeks and shares his experiences at public conferences.
Besides the computer world, he lives in Istanbul with his wonderful wife and two cockatiels. He likes to spend his spare time with his wife by walking at least 1 hour per day, visiting different places, watching cartoons, and going on summer holidays.
www.PacktPub.com
eBooks, discount offers, and more
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 customercare@packtpub.com 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.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Preface
RESTful services have become the de facto standard data feed providers for social services, news feeds, and mobile devices. They deliver a large amount of data to millions of users; therefore, they need to address high-availability requirements such as reliability and scalability. This book will show you how to utilize the Node.js platform to implement a robust and performant data service. By the end of the book you will have learned how to implement a real-life RESTful service, taking advantage of the modern NoSQL database for serving both JSON and binary content. Important topics such as correct URI structuring and security features are also covered with detailed examples, showing you everything you need to know to start implementing robust RESTful APIs serving content for your applications!
What this book covers
, REST What You Did Not Know , gives you a brief introduction into the history of REST and how it couples with the HTTP protocol.
, Getting Started with Node.js , teaches you how to install Node.js and how to work with its package manager to install modules, develop your first HTTP server application, and write automated unit tests for the HTTP handler by using mock request objects.
, Building a Typical Web API , teaches you how to structure your application using human-readable URL and URI parameters and develop a read-only RESTful service application using the filesystem as storage.
, Using NoSQL Databases , explains how to use LevelDB and MongoDB NoSQL databases, understand the difference between key/value and document data stores, and write automated tests for NoSQL user defined modules.