I always try to do my best and put my full efforts to complete the things. Whenever, I start something new I follow these lines from the poem Stopping by woods by snowy evening by Robert Frost:
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep
Sometimes, it looks, ah! I get into a tedious task and on the other hand I found nothing is impossible. Finally, after a sleepless nights and restless days, I completed my next book Building RESTful Web services with .NET Core. This project was not possible without the help of our young champion and Microsoft MVP Tadit Dash.
Everything is going as per plan suddenly we came to know that the publish date is preponed and it happened when a very good member of our team Mr. Vikas Tiwari is released from the team. At that time we were struggling to wrap up the book and we met with the PACKT enthusiasts. I am thankful to Anugraha Arunagiri and Jash Bavishi who made it possible and now it looks like a miracle.
Every parents have a dreams about their children, in my view it is responsibility of children to fulfill their dreams. I tried to achieve dreams for my mother. This book is dedicated to my parents and my little sister
To my mother, Late Smt. Santosh, and to the memory of my father, Late Sh. Ramkrishan, for
their sacrifices and for exemplifying the power of determination. To my youngest sister Late
Baby Kanchan for her love and always being my lucky charm.
First edition: May 2018
REST is an architectural style that tackles the challenges of building scalable web services. In today’s connected world, APIs have taken a central role on the web. APIs provide the fabric through which systems interact, and REST has become synonymous with APIs. The depth, breadth, and ease of use of ASP.NET Core makes it a breeze for developers to work with for building robust web APIs. This book takes you through the design of RESTful web services and leverages the ASP.NET Core framework to implement these services. This book begins by introducing you to the basics of the philosophy behind REST. You’ll go through the steps of designing and implementing an enterprise-grade RESTful web service. This book takes a practical approach, that you can apply to your own circumstances. This book brings forth the power of the latest .NET Core release, working with MVC. Later, you will learn about the use of the framework to explore approaches to tackle resilience, security, and scalability concerns. You will explore the steps to improve the performance of your applications. You’ll also learn techniques to deal with security in web APIs and discover how to implement unit and integration test strategies. By the end of the book, you will have a complete understanding of Building a client for RESTful web services, along with some scaling techniques.
What You Will Learn?
Developing Distributed Web Services to improve scalability with .NET Core 2.0 and ASP.NET Core 2.0
- Add basic authentication to your RESTful API
- Create a Carts Controller and Orders Controller to manage and process Orders
- Intercept HTTP requests and responses by building your own middleware
- Test service calls using Postman and Advanced REST Client
- Secure your data/application using annotations
Table of Contents
- GETTING STARTED
- Discussing RESTful services
- ASP.NET Core and RESTful services
- BUILDING THE INITIAL FRAMEWORK – LAYING THE FOUNDATION OF THE APPLICATION
- Setting up the environment
- SOAP versus REST
- Single-page application model
- Service-oriented architecture
- USER REGISTRATION AND ADMINISTRATION
- Why authentication and limiting requests?
- Database design
- User registration
- Adding basic authentication to our REST API
- Adding OAuth 2.0 authentication to our service
- Client-based API-consumption architecture
- ITEM CATALOGUE, CART, AND CHECKOUT
- Implementing controllers
- Product listing
- Product searching
- Adding to cart
- Implementing security
- Placing orders
- Exposing shipping details
- INTEGRATING EXTERNAL COMPONENTS AND HANDLING
- Understanding the middleware
- Adding logging to our API in middleware
- TESTING RESTFUL WEB SERVICES
- Test paradigms
- Testing approach
- Types of tests
- CONTINUOUS INTEGRATION AND CONTINUOUS DEPLOYMENT
- Introduction – deployment terminology
- The Azure environment
- SECURING RESTFUL WEB SERVICES
- OWASP security standards
- Securing RESTful web services
- Authentication and authorization in action
- SCALING RESTFUL SERVICES (PERFORMANCE OF WEB SERVICES)
- Load balancing
- Introduction to scalability
- Distributed caching
- BUILDING A WEB CLIENT (CONSUMING WEB SERVICES)
- Consuming RESTful web services
- Building a REST web client
- Implementing a REST web client
- INTRODUCTION TO MICROSERVICES
- Overview of microservices
- Understanding microservice architecture
- Communication in microservices
- Why we should use microservices
- How a microservice architecture works
- Advantages of microservices
- DevOps culture
- Microservices ecosystem in ASP.NET Core
Gaurav Aroraa has done M.Phil in computer science. He is a Microsoft MVP, certified as a scrum trainer/coach, XEN for ITIL-F, and APMG for PRINCE-F and PRINCE-P. Gaurav serves as a mentor at IndiaMentor, webmaster of dotnetspider, contributor to TechNet Wiki, and co-founder of Innatus Curo Software LLC. In the 19+ years of his career, he has mentored thousands of students and industry professionals. You can reach Gaurav via his blog, LinkedIn, and twitter handle
To my wife, Shuby Arora, and my angel (daughter), Aarchi Arora, who permitted me to steal time for this book from the time I was supposed to spend with them. Thanks to the entire Packt team, especially Ulhas, Vikas Tiwari, Anugraha Arunagiri, and Jash Bavishi, whose coordination and communication during the period was tremendous, and Denim Pinto, who introduced me for this book.
Tadit Dash is a senior software engineer and a hardcore tech community contributor. Due to his exceptional contribution to the technical community, Microsoft has awarded him with the Microsoft Most Valuable Professional accolade since 2014. CodeProject has awarded him the CodeProject MVP accolade (the first from Odisha). For his constant mentorship, IndiaMentor featured him as a young mentor on their site. He was a featured speaker at DevTechDay Nepal and C# Corner Annual Conference, India. You can follow him on Twitter:
To Utkal Techies Forum members Suvendu Giri, Pravasini Sahoo, Suraj Sahoo, Surya Barik, Abhijit Pattnaik, Sourav Nanda, Jayant Rajwani, Ramesh Barik; my friends Manas
Pritam, Deepak Mahapatra; my cousins Lipsa, Aurobin, Titiksha, Juthika, Amrit, Sanvi,
Anushka, Swostik; my mentor Gaurav Arora; and the Packt team, Denim Pinto, Vikas
Tiwari, Anugraha Arunagiri, and Jash Bavishi.
Author(s) write their stories, reviewers(s) polish the story for audience, thanks to all great reviewer(s) for their splendid job.
Hansamali Gamage is an experienced professional and Microsoft MVP in Visual Studio and Technologies from Sri Lanka. She possesses 5+ years of experience in .NET stack and Azure-related services. She is a frequent speaker at local and global tech events. She is a tech enthusiast and an award-winning writer on the Microsoft Tech Net forum. She works at TIQRI, previously known as Exilesoft, which is technology-focused software engineering company that has offices in Scandinavia, Asia, and Australia.
I would like to thank my loving family for their continuous help and support.
How to get this book?
Book is available at:
- Packt website, you can directly by it from: https://www.packtpub.com/application-development/building-restful-web-services-net-core
- Microsoft store, you can get ePub copy from: https://goo.gl/sS3Pbo
- Amazon website, you can get one from: https://amzn.to/2JOebXY
- Safari books online: https://goo.gl/aeMn4z
Your feedback is very important that help me to understand & help me to improve contents (if any) further.
Thanks for giving your time and joining me!