Replies: 2 comments 1 reply
-
To follow up. To achieve what I'm trying to achieve, having new endpoint is not neccessary. However, then I need a way to persist data into additional fields of an entity. How would I do that from start to finish - from sending a request to the server and actually storing that data after some transformations into the database? Should I use medusa widgets for that? P.S. |
Beta Was this translation helpful? Give feedback.
-
I can't say on the full process, but if you want to extend the endpoint you can extend whichever entity you want: https://docs.medusajs.com/development/entities/extend-entity and same for the service. But if you want to have less exposure to doing everything yourself, could also consider the medusa plugin medusa-extender https://github.com/adrien2p/medusa-extender. I've not used it but it claims to make the process of extending existing endpoints and creating new ones easy. edit to say that you didn't mention storage. But you will need to consider what to do with the image, you can store raw image data in the database but that can get bloat your DB quickly and it can be messy unless you have a well-designed system. The most likely scenario is upload the user's file to S3 or other storage, and just persist the link in medusa by extending the revelent entity and service. Frontend can fetch from the storage which reduces your server load. There are plugins for storage if you don't want to write your own :) |
Beta Was this translation helpful? Give feedback.
-
Hi.
Some background what I need to achieve.
I want to let user to upload an image besides a product when user is adding it to cart.
So the problem I need help with, is how to properly customize medusa backend and storefront to be able to achieve this.
Main issues are:
For example, how can I change the following requests path - I need it to call my new endpoint in a new route. Also, how could I add some new properties to request object? Since all of this functionality is embedded into library, I can't get any good reference point to replicate existing functionality.
Beta Was this translation helpful? Give feedback.
All reactions