node-amp-live-list
node-amp-live-list copied to clipboard
Liveblog in AMP that shows Youtube videos. Implemented with the amp-live-list component and a Node.js/Express/EJS backend.
node-amp-live-list
A sample app to show how the amp-live-list works (by showing a feed of YouTube videos) with the help of a Node.js/Express backend.
Follow the tutorial at https://blog.pusher.com/building-a-realtime-feed-with-node-js-and-amp/
Requirements
Installation
- Clone this repository and
cdinto it. - Execute
npm installto download dependencies. - Execute
node server.jsto start the Node.js server. - Go to http://localhost:3000.
- To register videos, you can use a tool like Postman to hit the http://localhost:3000/new endpoint with a JSON payload like the following:
{
"videoID": "[YOUTUBE_VIDEO_ID]"
}
Or cURL:
# POST
curl -H "Content-Type: application/json" -X POST -d '{"videoID":"[YOUTUBE_VIDEO_ID]"}' http://localhost:3000/new
# In Windows, change single quotes to quotation marks and escape the ones inside curly brackets
curl -H "Content-Type: application/json" -X POST -d "{\"videoID\":\"[YOUTUBE_VIDEO_ID]\"}" http://localhost:3000/new
# Or use file, for example data.json
curl -H "Content-Type: application/json" -X POST --data @data.json http://localhost:3000/new
After a few seconds (fifteen at most), the button to load the new videos should be visible. Click on it to show the updates.
License
MIT