Reputation: 37
I am new to ServiceStack and I have been tasked with optimizing/cleaning up our current setup with ServiceStack. We have a relatively extensive website built (meaning 60+ endpoint locations), and I wanted to make one central controller that handles all the routing. But I can't get this to work very well, because it seems that I NEED to have the [Route()] declared over the Request DTO and ONLY there. Anywhere else its declared the route doesn't work.
Is there any other way possible to do this with ServiceStack? Like putting route declarations over methods for example?
Or maybe using Fluent API? I cant find much documentation on how to implement Fluent API, and I tried it but it didn't seem to work, so I must be missing something.
Upvotes: 2
Views: 33
Reputation: 143319
Yes you can use ServiceStack's Fluent API, e.g:
Routes
.Add<Hello>("/hello")
.Add<Hello>("/hello/{Name}");
.Add<GetContact>("/Contacts", "GET")
.Add<GetContact>("/Contacts/{ContactId}", "GET");
You can also register them using Auto Route Generation Strategies.
Upvotes: 2