2

I have a REST API that I'd like to port to run as a collection of cloud functions. I'm wondering how to split up the different endpoints in the best way, and how much to rename endpoints to fit the GCF model.

For example, I have the following types of request.

GET /images
GET /images/<image_id>
POST /images

If this was implemented with GCF, these would all fall under the same function images, and then I would need to implement some routing based on HTTP method, plus a pattern match for <image_id>, etc..

I could however choose to implement something like...

GET /images
GET /image/<image_id>
POST /createImage

...so that each endpoint has a distinct function that is invoked. This seems more appropriate from a cloud functions point of view, but not at all appropriate from a RESTful design point of view.

What are the trade-offs for implementing cloud functions in one or the other of these ways?

Andy Hume
  • 40,474
  • 10
  • 47
  • 58
  • A little late... but I'm curious if you figured out a solution. I'm in the process of porting over an API as well and I'm unclear on the best approach here. Doesn't seem like a natural fit. – Runicode Oct 24 '18 at 02:25

0 Answers0