What are Entities in Medusa js

Published: 09 March 2024
on channel: ZeeCoding
223
4

@zeecoding
#coding #zeecoding #learncoding #codingforbeginners
Entities in medusa represent tables in the database as classes. An example of this would be the Order entity which represents the order table in the database. Entities provide a uniform way of defining and interacting with data retrieved from the database.

Aside from the entities in the Medusa core package, you can also create custom entities to use in your Medusa backend. Custom entities are TypeScript or JavaScript files located in the src/models directory of your Medusa backend. You then transpile these entities to be used during the backend's runtime using the build command, which moves them to the dist/models directory.

Entities are based on Typeorm’s Entities and use Typeorm decorators. Each entity also require a repository to be created. A repository provides basic methods to access and manipulate the entity's data.


Watch video What are Entities in Medusa js online without registration, duration hours minute second in high quality. This video was added by user ZeeCoding 09 March 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 223 once and liked it 4 people.