Alias routes for autogenerated CRUD endpoints

Hello,

I'm porting a nodejs server to BIZ using a database-first approach, generating entities via TAureliusConnection.
Then, setting in TXDataServer the DefaultEntitySetPermissions gives an almost immediate way to have a full working server in few minutes with all the desired CRUD endpoints... absolutely great!

Now, if the table name in the DB is 'com_apps' then the auto-generated endpoint will be '/com_apps' ...is there a way to turn it into 'com/apps' directly (in the Entity?) without adding a Service with [Route('com/apps')] ?

Thank you in advance.

Yes, you can use URIPath attribute as stated in documentation: TMS Aurelius CRUD Endpoints | TMS XData documentation

uses {...}, XData.Service.Common;

type
  [URIPath('Customers')]
  TCustomer = class

Thank you! As soon as I was reading your reply I remembered I have read a while ago about the URIPath attribute,,, and of course forgot about it - the documentation is so GREAT and well structured but the product is so BIG that it will take me months (years?) to know it deep enoght...

It seems that URIPath cannot handle complete path (only "questions" in example below)

I've tried [URIPath('com/apps')] and even encoded [URIPath('com%2Fapps')]

but that leads to UrlInfoError :thinking:

Indeed, for entities, the URIPath attribute (or Route attribute) doesn't allow multiple segments. You can only change the name of the single path segment.

For multiple segments, you should use service operations.

Understood, thanks for clarification!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.