Understanding the makeup of a Strapi API
Several files were created for us under the src/api
folder when we created the classroom
content-type. Now, we will take a look at the updated project structure and consider a general overview of what was created.
Routes, controllers, services, and models
When we created our first content-type in the admin panel, several files were created under the src/api
folder:
Let us have a quick overview of the route components of a Strapi API, that is the routes, controllers, services and models:
- There are two types of routes in Strapi, a core route and a custom route. Core routes are automatically created by Strapi when a new content-type is created; the core routes are
find
,findOne
,create
,update
, anddelete
. Theroutes/{content-type}.js
file contains the core route (or endpoint) definitions. This file uses acreateCoreRouter
factory function that automatically...