docs: add documentation for Locking Module (#11824)
* add locking docs * fix main navbar * added implementation example links * generate refs * update architecture * fix vale error
This commit is contained in:
@@ -4,9 +4,17 @@ slug: /references/file-provider-module
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
|
||||
# How to Create a File Provider Module
|
||||
# How to Create a File Module Provider
|
||||
|
||||
In this document, you’ll learn how to create a file provider module and the methods you must implement in its main service.
|
||||
In this document, you’ll learn how to create a File Module Provider and the methods you must implement in its main service.
|
||||
|
||||
---
|
||||
|
||||
## Implementation Example
|
||||
|
||||
As you implement your File Module Provider, it can be useful to refer to an existing provider and how it's implemeted.
|
||||
|
||||
If you need to refer to an existing implementation as an example, check the [S3 File Module Provider in the Medusa repository](https://github.com/medusajs/medusa/tree/develop/packages/modules/providers/file-s3).
|
||||
|
||||
---
|
||||
|
||||
@@ -26,9 +34,9 @@ The rest of this guide always uses the `src/modules/my-file` directory as an exa
|
||||
|
||||
---
|
||||
|
||||
## 2. Create the File Provider Service
|
||||
## 2. Create the File Module Provider's Service
|
||||
|
||||
Create the file `src/modules/my-file/service.ts` that holds the implementation of the module's main service. It must extend the `AbstractFileProviderService` class imported from `@medusajs/framework/utils`:
|
||||
Create the file `src/modules/my-file/service.ts` that holds the implementation of the module provider's main service. It must extend the `AbstractFileProviderService` class imported from `@medusajs/framework/utils`:
|
||||
|
||||
```ts title="src/modules/my-file/service.ts"
|
||||
import { AbstractFileProviderService } from "@medusajs/framework/utils"
|
||||
@@ -224,7 +232,7 @@ class MyFileProviderService extends AbstractFileProviderService {
|
||||
|
||||
---
|
||||
|
||||
## 3. Create Module Definition File
|
||||
## 3. Create Module Provider Definition File
|
||||
|
||||
Create the file `src/modules/my-file/index.ts` with the following content:
|
||||
|
||||
@@ -240,11 +248,11 @@ export default ModuleProvider(Modules.FILE, {
|
||||
})
|
||||
```
|
||||
|
||||
This exports the module's definition, indicating that the `MyFileProviderService` is the module's service.
|
||||
This exports the module provider's definition, indicating that the `MyFileProviderService` is the module provider's service.
|
||||
|
||||
---
|
||||
|
||||
## 4. Use Module
|
||||
## 4. Use Module Provider
|
||||
|
||||
To use your File Module Provider, add it to the `providers` array of the File Module in `medusa-config.ts`:
|
||||
|
||||
@@ -286,4 +294,4 @@ module.exports = defineConfig({
|
||||
|
||||
## 5. Test it Out
|
||||
|
||||
To test out your file provider, use the Medusa Admin or the [Upload API route](https://docs.medusajs.com/v2/api/admin#uploads_postuploads) to upload a file.
|
||||
To test out your File Module Provider, use the Medusa Admin or the [Upload API route](https://docs.medusajs.com/v2/api/admin#uploads_postuploads) to upload a file.
|
||||
|
||||
Reference in New Issue
Block a user