This package is a library for handling OADA formats in HTTP servers (currently
supports express
and fastify
).
yarn add @oada/formats-server
It will set relevant HTTP headers for known OADA formats. If it encounters an unknown format, it leaves the headers alone.
// Import the middleware version
import { middleware: formats } from '@oada/formats-server';
// Must be `use`d _after_ the `Content-Type` is set to work properly
app.use(formats())
// Import the fastify plugin
import { plugin: formats } from '@oada/formats-server';
fastify.register(formats)