ampproject / samples

Apache License 2.0
444 stars 191 forks source link

Fix 'mustache.to_html is not a function' in amp-camp demo #338

Closed maguayo closed 3 years ago

maguayo commented 3 years ago

This commit solves the following error while running Gulp:

let rendered = mustache.to_html(content.toString(), options);
                                ^
TypeError: mustache.to_html is not a function
CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

morsssss commented 3 years ago

Thanks for submitting this PR! Indeed, this code is pretty old, and I think we must have been using something that's no longer part of the mustache API.

Does this change make the site work for you? I tried it, and I still had no luck. I think the problem is, as you can see here, that this demo site relies on an API hosted by our friends at Wompmobile. That API lives, or lived, at this URL:

https://campmor.ampify.wompmobile.com/campmor

But I think that API's no longer maintained.

If that's right, then to bring this back to life, we'd need a working product API.

maguayo commented 3 years ago

With the change I made, the website works, but as you pointed out, the API doesn't. But at least I got the website running.

morsssss commented 3 years ago

😏 Well, in any case, your change is correct! Let's get it merged in, and I'll see if our friend can get the API back up.

If not, I suppose we'd need to use our own mock data and create our own services.

morsssss commented 3 years ago

Good news. Womp got the API back up!

https://camp.samples.amp.dev/product-listing?gender=women&category=shirts

Thanks for getting the server updated :)