Hi all,
Can you please tell me how to map / endpoint for UI app, /api/ for REST API, and /graphql/ ?
I tried a couple of combinations but always / has priority, the rest of endpoints are not mapped to the their functions.
functions:
RestAPI:
handler: handler.RestAPI
events:
- http:
path: /api/{any+}
method: any
cors: true
GraphQL:
handler: handler.GraphQL
events:
- http:
path: /graphql/{any+}
method: any
cors: true
UI:
handler: handler.UI
events:
- http:
path: /{any+}
method: get
cors: true
Your catchall paths should use {proxy+}
, not {any+}
.
Defined paths will always override catchalls.
Hi @jeremydaly
I tried with the following but doesn’t work
functions:
RestAPI:
handler: handler.RestAPI
events:
- http:
path: /api/{any+}
method: any
cors: true
GraphQL:
handler: handler.GraphQL
events:
- http:
path: /graphql/{any+}
method: any
cors: true
UI:
handler: handler.UI
events:
- http:
path: /{proxy+}
method: get
cors: true
Done. With the following config works. Thank you @jeremydaly for the tip.
functions:
RestAPI:
handler: handler.RestAPI
events:
- http:
path: /api/{proxy+}
method: any
GraphQL:
handler: handler.GraphQL
events:
- http:
path: /graphql/{proxy+}
method: any
UI:
handler: handler.UI
events:
- http:
path: /{proxy+}
method: any
1 Like
Should have told you to replace all of your {any+}
s. Glad you got it working!