Open ryckmanat opened 1 year ago
The example servers all add an "/ingest" endpoint (which is, optionally, protected). It looks like this today:
const ingestEndpoint = { method: ['POST'], handle: async () => { const changes = [] as Array<OfferChange>; const changeHandler = api.registerChangeHandler(async change => { changes.push(change); }); await s.ingest(); changeHandler.remove(); return changes; }, } as CustomRequestHandler;
Given that this is commonly wanted, we should move it to the opr-core library and make it easily installable in any server.
This should be created under opr-core/src/server/installable-endpoints/ingest.ts. Then, export the endpoint as a CustomRequestHandler.
opr-core/src/server/installable-endpoints/ingest.ts
The example servers all add an "/ingest" endpoint (which is, optionally, protected). It looks like this today:
Given that this is commonly wanted, we should move it to the opr-core library and make it easily installable in any server.
This should be created under
opr-core/src/server/installable-endpoints/ingest.ts
. Then, export the endpoint as a CustomRequestHandler.