Reputation: 51
get_all_regions:
handler: regions/admin/handler.get_all_regions
tags:
Name: get-all-regions
events:
- httpApi:
method: GET
path: /admin/regions
get_all_regions_preflight:
handler: default/handler.get_preflight
tags:
Name: get-preflight
events:
- httpApi:
method: OPTIONS
path: /admin/regions
get_region:
handler: regions/admin/handler.get_region
tags:
Name: get-region-details
events:
- httpApi:
method: GET
path: /admin/regions/{id}
get_region_preflight:
handler: default/handler.get_preflight
tags:
Name: get-preflight
events:
- httpApi:
method: OPTIONS
path: /admin/regions/{id}
create_region:
handler: regions/admin/handler.create_region
tags:
Name: add-region
events:
- httpApi:
method: POST
path: /admin/regions
Error: New route /local/admin/regions conflicts with existing /local/admin/regions.
I keep getting this error despite having those routes with different method types. I have tried searching online but haven't found anything, I am trying to follow REST API conventions and hence keep it this way.
Upvotes: 1
Views: 1036
Reputation: 12389
The conflicting routes are the following:
get_region_preflight:
handler: default/handler.get_preflight
tags:
Name: get-preflight
events:
- httpApi:
method: OPTIONS
path: /admin/regions/{id}
get_all_regions_preflight:
handler: default/handler.get_preflight
tags:
Name: get-preflight
events:
- httpApi:
method: OPTIONS
path: /admin/regions
You're trying to deploy the same function twice, try :
get_regions_preflight:
handler: default/handler.get_preflight
tags:
Name: get-preflight
events:
- httpApi:
method: OPTIONS
path: /admin/regions
- httpApi:
method: OPTIONS
path: /admin/regions/{id}
Upvotes: 2