We always recommend that you should proxy the BaaS apis via EDGE. And this is why we say so:
1. You can change the authentication mechanism.
By default BaaS supports certain flows of Oauth for accessing the data. You may not like it. You may want to have basic auth, web server flow of Oauth, SAML etc. If you proxy the BaaS APIs via edge you can change the authentication schemas in any ways suitable.
b. Have the same credentials for accessing BaaS APIs and any other APIs
BaaS credentials are different than all other APIs. You want same set of credentials for access all APIs.
2. You can change the URL structure
The URLs of BaaS looks in a certain way. Which may be different from your URL structure. Using Edge you can do URL transform to make the APIs look similar.
3. Error codes may be different
BaaS error codes may be different from your backend error codes.
If you create a proxy of BaaS APIs you can normalize the error codes.
4. Payload structure may be different
BaaS payloads may vary significantly from your backend and you may want to apply transformations to them to make the payloads look similar. BaaS supports only JSON whereas your other APIs may support XML as well. You can transform Json - XML in BaaS.
5. Analytics data
BaaS has some analytics in built, but it is rudimentary.
Once you proxy the BaaS APIs via EDGE you can start getting the rich analytics offered by Edge.
6. BaaS + node is powerful tool in your arsenal
You can use BaaS as your data store and write business logic in node and expose the APIs quickly to the consumers. This is a very powerful way to expose experimental APIs, sandbox environments etc. and in some cases may also be used for production APIs.
7. Sanitize the data to your liking
Each entity in BaaS stores a few data elements of its own like - created,modifiedat,path etc. You may not like these elements and create a policy in Edge to remove all of these.
8. Validate payloads for the POST/PUT operations
There is no way in BaaS to directly validate the incoming request schema/check for various threats like sql injection/CSRF etc. You can enforce these via Policies in Edge.
9. Offer BaaS apis to your consumers like any other API
You can open up the BaaS apis for consumption like any of your other APIs. For doing that you need to represent BaaS APIs as part of API products, document the BaaS APIs in dev portal etc.
10. Create mashups with BaaS data
Often data in BaaS in spread over multiple collections. And you might need to do mashups of these data before serving up to the consumers. There are multiple ways to do mashup in edge and is a very common use case.
11. Cache BaaS data in Edge
A lot of data from BaaS should be cacheable. BaaS is extremely optimized for very high read rate. By caching a good portion of the data in Edge will make data access even faster.
12. Don’t expose the BaaS query language to the outside world
BaaS has a very powerful query language built in which is awesome but proprietary. You may wanna hide that and expose a generic rest layer to your api consumers.