There's no great way to handle this. If you use Express then every endpoint is under the same endpoint, as far as Google analytics goes.
One way is to do as you suggested, where you have the word 'get', 'post', etc in the URL, but then you can create one additional endpoint that doesn't have the method in the name (no 'get' or 'post' etc) and in that function check the 'request.method' and then request.redirect to the other appropriate function that has the 'get' 'post' etc in it.
So I have these public urls:
www.myWebsite.com/customer/get
www.myWebsite.com/customer/post
For these internal functions
export const cust_get = onRequest((request, response)...
export const cust_post = onRequest((request, response)...
with these URL rewrites
{
"source": "/customer/get/**",
"function": "cust_get"
},
{
"source": "/customer/post",
"function": "cust_post"
},
where of course in the cust_get I'll have to parse out the customer ID from the path (it not using Express).
But then I also add an extra function
export const cust = onRequest((request, response)=>{
if (request.method == 'POST')
response.redirect('/customer/post');
else if (request.method == 'GET')
response.redirect('/customer/get');//you'll need to also pass any params passed in
}
And then add one more rewrite for that...
{
"source": "/customer",
"function": "cust"
},
It's still ugly since the client has to make two http calls; however, if they don't like it, they can just call the customer_get or customer_post directly.