future-micropub-endpoint icon indicating copy to clipboard operation
future-micropub-endpoint copied to clipboard

Package proposal: Form-encoded request to mf2

Open paulrobertlloyd opened this issue 6 years ago • 4 comments

In the spirit of creating small un-opinionated packages that do one thing well (rather than attempt to build a single monolith package), a candidate for broader collaboration between node-based projects would be one that rewrites Microformats parameters provided in a form-encoded POST request and converts them to mf2.

Prior art

Micropub Express / IndieKit

IndieKit performs this function in code that can be found here. This was adapted from code found in Micropub Express by @voxpelli which can be found here.

Postr

Postr performs this function in an Express middleware function that can be found here.

Final thoughts

For me this was one of the trickiest building blocks to understand and ~~build~~ adapt, and like post type discovery, prone to errors. It’d be nice to collaborate on a common package that accounts for all the possible form-encoded requests that may need to be converted into mf2.

@indieweb/form-encoded-to-mf2 anyone?

paulrobertlloyd avatar Jul 26 '19 21:07 paulrobertlloyd

So for this one, while I agree it should be somewhat independent, I don't think it should be its own module, mainly because its only use case (that I can think of) is inside a micropub endpoint. And I think our goal with a fill micropub endpoint middleware should be that everyone would want to use the full package, not just form encoded -> mf2 object conversion

In my opinion it should be a middleware within a micropub endpoint middleware, that could be used standalone if someone really, really wanted to.

Having said that it is a good starting point that could be developed and tested separately from a micropub endpoint.

grantcodes avatar Jul 26 '19 22:07 grantcodes

For me this was one of the trickiest building blocks to understand and build [...] prone to errors.

A first step here could be to make a test suite that one can add to test an implementation of this, taking inspiration from eg:

  • https://www.npmjs.com/package/abstract-blob-store
  • https://www.npmjs.com/package/abstract-chunk-store
  • https://github.com/voxpelli/node-webmention-testpinger
  • https://github.com/pfefferle/node-webmention-testendpoint

voxpelli avatar Jul 28 '19 17:07 voxpelli

our goal with a fill micropub endpoint middleware should be that everyone would want to use the full package

As I wrote in #1, what our goal in my opinion should be, and I get the feeling that @paulrobertlloyd agrees, to help one another in building our endpoints.

Collaborating in removing the need for implementing ones own error prone and boring methods like this one + adapting similar API:s to enhance the ecosystem and allow for an extension of one endpoint to also be used with another one.

So anyone can eg. add media functionality that works with multiple endpoint implementations, thus making it less of an effort to maintain any single project within this space.

voxpelli avatar Jul 28 '19 17:07 voxpelli

I get the feeling that @paulrobertlloyd agrees, to help one another in building our endpoints.

Correct! I don’t think the requirement for a package should be “can it be used for different IndieWeb projects (Micropub, Microsub, Webmention)” necessarily, more “can authors of different Micropub projects drop in a package to address the dull/boring/complex/error-prone parts of the spec”.

paulrobertlloyd avatar Jul 28 '19 23:07 paulrobertlloyd