docs: added optional step for local file service (#4126)

This commit is contained in:
Shahed Nasser
2023-05-18 18:24:27 +03:00
committed by GitHub
parent eba21d9c5f
commit 7787fe96aa

View File

@@ -402,6 +402,30 @@ npx @medusajs/medusa-cli develop
Then, try uploading a file, for example, using the [Upload File endpoint](/api/admin#tag/Uploads/operation/PostUploads). The file should be uploaded based on the logic youve implemented.
### (Optional) Accessing the File
:::note
This step is only useful if you're implementing a local file service.
:::
Since the file is uploaded to a local directory `uploads`, you need to configure a static route in express that allows accessing the files within the `uploads` directory.
To do that, create the file `src/api/index.ts` with the following content:
```ts
import express from "express"
export default () => {
const app = express.Router()
app.use(`/uploads`, express.static(uploadDir))
return app
}
```
---
## See Also