openhim-core
Version:
The OpenHIM core application that provides logging and routing of http requests
13 lines (9 loc) • 314 B
JavaScript
import * as tcpAdapter from '../tcpAdapter'
import { config } from '../config'
export async function koaMiddleware (ctx, next) {
// the body contains the key
const transaction = tcpAdapter.popTransaction(ctx.body)
ctx.body = transaction.data
ctx.authorisedChannel = transaction.channel
await next()
}