jackdbd / micropub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Micropub

Installation

npm install

Development

In one terminal, start the web server in watch mode:

npm run watch

In another terminal make some requests to the /micropub endpoint. You could also use any other HTTP client to make requests, for example Postman.

curl "${HOST}:3001/micropub" \
  -d h=entry \
  -d "content=Hello World" \
  -H "Accept: application/json" | jq
curl "${HOST}:3001/micropub" \
  -d h=entry \
  -d "content=Hello World" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer invalid-token" | jq

Obtain a valid access token using a micropub client, for example Quill or Micropublish.

Note

Create an h-entry representing a note.

The content of an h-entry could be either a string...

curl "${HOST}:3001/micropub" \
  -d h=entry \
  -d "content=Hello World" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $(cat secrets/token-endpoint-response.json | jq .access_token)" | jq

...or a JSON object with keys value and html.

curl "${HOST}:3001/micropub" \
  -d h=entry \
  -d "content={ \"value\": \"Hello World\", \"html\": \"<b>Hello</b> World\" }" \
  -d "published=1985-04-12T23:20:50.52Z" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $(cat secrets/token-endpoint-response.json | jq .access_token)" | jq

Like

Create an h-entry representing a like.

curl "${HOST}:3001/micropub" \
  -d h=entry \
  -d "like-of=http://othersite.example.com/permalink47" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $(cat secrets/token-endpoint-response.json | jq .access_token)" | jq

Repost

Create an h-entry representing a repost.

curl "${HOST}:3001/micropub" \
  -d h=entry \
  -d "repost-of=https://example.com/post" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $(cat secrets/token-endpoint-response.json | jq .access_token)" | jq

Test

npm run test

Deploy

Deploy to Google Cloud Platform.

npm run deploy

About


Languages

Language:TypeScript 93.8%Language:Dockerfile 5.6%Language:JavaScript 0.7%