Designing Web APIs with Strapi
eBook - ePub

Designing Web APIs with Strapi

Khalid Elshafie, Mozafar Haider

Buch teilen
  1. 310 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Designing Web APIs with Strapi

Khalid Elshafie, Mozafar Haider

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

Leverage the power of Strapi to build self-hosted, customizable, and performant content APIsKey Features• Discover how Strapi can help you build APIs quickly and focus on your products and features• Learn how to put Strapi into practice by implementing it in real-world scenarios• Understand how to use Strapi's powerful features to customize your APIsBook DescriptionStrapi is a Node.js-based, flexible, open-source headless CMS with an integrated admin panel that anyone can use and helps save API development time. APIs built with Strapi can be consumed using REST or GraphQL from any client. With this book, you'll take a hands-on approach to exploring the capabilities of the Strapi platform and creating a custom API from scratch.This book will help JavaScript developers to put their knowledge to work by guiding them through building powerful backend APIs. You'll see how to effortlessly create content structures that can be customized according to your needs, and gain insights into how to write, edit, and manage your content seamlessly with Strapi. As you progress through the chapters, you'll discover a wide range of Strapi features, as well as understand how to add complex features to the API such as user authentication, data sorting, and pagination. You'll not only learn how to find and use existing plugins from the open-source community but also build your own plugins with custom functionality with the Strapi plugin API and add them to the admin panel. Finally, you'll learn how to deploy the API to Heroku and AWS.By the end of this book, you'll be able to build powerful, scalable, and secure APIs using Strapi.What you will learn• Explore Strapi and understand how it works• Define content types to build APIs quickly and efficiently• Understand authentication and authorization in Strapi• Create production-ready APIs with Strapi• Deploy the Strapi API to various environments, including Heroku and AWS• Use best practices to run the Strapi API in production• Sync permissions to access the API between multiple environments• Write basic tests for API utilities as well as the endpointWho this book is forThis book is for backend and frontend JavaScript developers. Experienced API developers will learn a new, fast, and flexible way of building APIs, while frontend developers will be able to take a step toward becoming full-stack developers by learning how to leverage Strapi for building APIs quickly. Basic knowledge of JavaScript and REST API concepts is assumed.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Designing Web APIs with Strapi als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Designing Web APIs with Strapi von Khalid Elshafie, Mozafar Haider im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Computer Science & Content Management Systems. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2022
ISBN
9781800566705

Section 1: Understanding Strapi

Each journey starts with a first step. Our first step will be to understand the concept of headless CMS (short for Content Management System) and why Strapi is one of the most popular headless CMS around. Then, the chapters will move onto how to prepare the development environment and install and set up Strapi to build our first API.
In this section, we will cover the following topics:
  • Chapter 1, An Introduction to Strapi
  • Chapter 2, Building Our First API
  • Chapter 3, Strapi Content-Types
  • Chapter 4, An Overview of the Strapi Admin Panel

Chapter 1: An Introduction to Strapi

This chapter gives an introduction to Strapi. First, we will explain what Strapi is and what are the benefits of using it in developing API (short for application programming interface). Then, we will see how to set up and prepare our development environment to work with Strapi. Afterward, we will create a simple API to help us get started with Strapi. Finally, we will have a quick look at the server scripts offered by Strapi to start and stop the development server.
These are the topics we will cover in this chapter:
  • What is Strapi?
  • Why use Strapi? (The benefits of Strapi)
  • Preparing the development environment
  • Creating a Strapi application
  • Understanding server scripts

What is Strapi?

Strapi is a headless content management system (CMS).
A CMS is a software application used for web development that allows users to create, edit, and publish content.
A traditional CMS, such as WordPress, tightly couples the frontend and the backend—that is, the structure of the content and how it is presented. However, unlike traditional CMSes, a headless CMS is entirely decoupled from the presentation layer. The term headless comes from separating the head (the frontend) from the body (the backend). A headless CMS does not care about how the contents get displayed; instead, it provides a content-first approach with an API to access and display the data in any format desired.
You can see the differences between a traditional CMS and a headless CMS in the following diagram:
Figure 1.1: Traditional CMS versus headless CMS
Figure 1.1: Traditional CMS versus headless CMS
"Strapi" is wordplay for Bootstrap API. As the name suggests, it aims to help developers build (bootstrap) an API quickly. Strapi saves API development time through an integrated easy-to-use admin panel and a solid set of core features out of the box. Whether you are a backend, full stack, or frontend developer, you will find it extremely easy to get started with Strapi and API development without reinventing the wheel and wasting time in building common features such as basic create, read, update, and delete (CRUD) operations or authentication and authorization.
Now that we have familiarized ourselves with Strapi, let's see some of the advantages of using it.

Why use Strapi? (The benefits of Strapi)

There are several advantages to using Strapi, and we will outline some of the major benefits and reasons for using it next.

Open-source Node.js

Strapi is open-source and built on top of a popular Node.js framework: Koa. Its code is accessible and easily extendible. It's supported by a thriving company but also by a large community of contributors. You can find Strapi's code on GitHub at https://github.com/strapi/strapi.

Database-agnostic

Strapi can work with different database systems. It can be set up and configured to work with PostgreSQL, MySQL, MongoDB, and SQLite. We will see in Chapter 9, Production-Ready Applications, how we can configure Strapi to work with PostgreSQL.

Customizable (extendable)

Strapi is highly configurable to suit each project's specific requirements. All of the data types are created from scratch through the admin panel. Additionally, the Strapi plugin system makes it easy to extend its functionality with features such as database documenting, image uploads, and email configuration. We will discuss the Strapi plugin system in a later chapter of this book.

RESTful and GraphQL

Strapi provides a REpresentational State Transfer (REST) API out of the box. The API can be consumed from any web client (React, Angular, Vue.js, and so on), mobile applications, or even internet of things (IoT) applications using REST or GraphQL via a plugin.

Users and permissions

Strapi comes with a users and permissions model out of the box that allows you to define which endpoint is available for which user/role. Additionally, you can use Open Authorization (OAuth) to enable authentication via third-party providers such as GitHub, Facebook, Twitter, Google, and many others.
Now that we have understood what Strapi is all about, let's see how we can prepare our development environ...

Inhaltsverzeichnis