Slide 23
Slide 23 text
@dunglas - mercure.rocks
const http = require('http');
const querystring = require('querystring');
const postData = querystring.stringify({
'topic': 'https://example.com/books/1',
'data': JSON.stringify({ '@id': 'https://example.com/books/1', status: 'OufOfStock'}),
});
const req = http.request({
hostname: 'demo.mercure.rocks',
port: '80',
path: '/.well-known/mercure',
method: 'POST',
headers: {
Authorization: 'Bearer snip',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData),
}
});
req.write(postData);req.end();
Publishing: Node.js