entity-routes logo
Docs

Features#

entity-routes enables you to design your API around your TypeORM entities in minutes. It is compatible with Express/Koa or any connect-like framework, which should mean any middleware-based node layer (like Next, Nuxt, etc...).

Using entity-routes you won't have to write any boilerplate controllers with the same boring logic as usual for every entities you have.

You can just decorate your entity with @EntityRoute and enable the operations you want.

With the @Groups decorator you can configure your properties to be exposed in a specific or all route scopes. This will lead to optimized SQL queries with only properties exposed through @Groups to be selected. You can control recursion depth with @MaxDepth decorator.

You can have entity properties that have dedicated endpoints using Subresources and nested Subresources.

Built-in validation#

Use class-validator/entity-validator decorators on your entities to describe how to validate them

entity-routes generates endpoints (for each route scope) to get the summary of an entity exposed properties, inferred from your @Entity entities and their @Groups decorated properties.

You can use list filters to alter items returned with auto SQL generated conditions. We have two built-in powerful filters for lists (Search/Pagination) that should fit well for 99% use cases. But you can also make your own custom filters if you find yourself in the 1%

There are hooks available to intervene at any point in the process of a request handling.

You can have methods exposed as properties in your API responses. Those methods can be asynchronous and can also require other entity properties that are not exposed through @Groups and still be resolved with @DependsOn decorator.

Re-usable service components#

Everything is exported so you have access to every components that are used internally and you can use them your own way.

Next
Installation