W
Wasp-lang10mo ago
cubub

API versioning, is there any best practices?

I'm converting one project to wasp and it use API versioning (like: /api/v1/products). So in this case what should we do?
1 Reply
martinsos
martinsos10mo ago
If that API is being consumed only by the Wasp itself, the Wasp client, and you are rewriting it using Wasp Operations (RPC), then I wouldn't worry about it. If the API is being also consumed by the external services, then it might make sense to do what you did there, with v1, and you can easily do that with Wasp, by using: https://wasp-lang.dev/docs/advanced/apis .
Custom HTTP API Endpoints | Wasp
In Wasp, the default client-server interaction mechanism is through Operations. However, if you need a specific URL method/path, or a specific response, Operations may not be suitable for you. For these cases, you can use an api. Best of all, they should look and feel very familiar.