- Move the original guides for creating endpoints and middlewares to sub-sections in the Endpoints category. - Replace existing guides for endpoints and middlewares with the new approach. - Update all endpoints-related snippets across docs to use this new approach.
68 lines
2.1 KiB
Plaintext
68 lines
2.1 KiB
Plaintext
import DocCardList from '@theme/DocCardList';
|
||
import Icons from '@theme/Icon';
|
||
|
||
# API Routes
|
||
|
||
In this document, you’ll learn what API Routes are in Medusa.
|
||
|
||
## Introduction
|
||
|
||
The Medusa Backend is a Node.js headless server. It exposes commerce functionalities implemented by Medusa's [commerce module](../../modules/overview.mdx) through REST APIs that external or frontend applications can access to process or retrieve data.
|
||
|
||
The backend exposes two types of API routes: Store APIs and Admin APIs. The Store APIs are typically accessed from the storefront. For example, you can use the Store APIs to show customers available products or implement a cart and checkout flow.
|
||
|
||
The Admin APIs are typically accessed from an admin dashboard. For example, you can use the Admin APIs to allow admins to manage the store’s data such as products, orders, and so on.
|
||
|
||
<DocCardList colSize={6} items={[
|
||
{
|
||
type: 'link',
|
||
href: 'https://docs.medusajs.com/api/store',
|
||
label: 'Store APIs',
|
||
customProps: {
|
||
icon: Icons['server-solid'],
|
||
description: 'Check out available Store REST APIs.'
|
||
}
|
||
},
|
||
{
|
||
type: 'link',
|
||
href: 'https://docs.medusajs.com/api/admin',
|
||
label: 'Admin APIs',
|
||
customProps: {
|
||
icon: Icons['server-solid'],
|
||
description: 'Check out available Admin REST APIs.'
|
||
}
|
||
},
|
||
]} />
|
||
|
||
---
|
||
|
||
## Custom Development
|
||
|
||
Aside from using the Medusa backend's API routes, developers can create their own API routes either directly in the Medusa Backend or in a plugin.
|
||
|
||
:::tip
|
||
|
||
As the core Medusa package is completely customizable, developers can also extend the functionality even further to implement GraphQL routes.
|
||
|
||
:::
|
||
|
||
<DocCardList colSize={6} items={[
|
||
{
|
||
type: 'link',
|
||
href: '/development/api-routes/create',
|
||
label: 'Create an API Route',
|
||
customProps: {
|
||
icon: Icons['academic-cap-solid'],
|
||
description: 'Learn how to create an API Route in Medusa.'
|
||
}
|
||
},
|
||
{
|
||
type: 'link',
|
||
href: '/development/api-routes/add-middleware',
|
||
label: 'Add a Middleware',
|
||
customProps: {
|
||
icon: Icons['academic-cap-solid'],
|
||
description: 'Learn how to add a middleware in Medusa.'
|
||
}
|
||
},
|
||
]} /> |