dev-api: add developer portal, OpenAPI spec, and Flatenbadet case study
- New /developers/ page with API docs, SDKs, pricing, use cases - OpenAPI 3.0 spec for Orders, Missions, Photos, Analytics - Case study: Glasskiosken i Flatenbadet — complete ROI analysis - Updated /order/ with recurring missions and frequency dropdown
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
mapHttpResponse,
|
||||
resSerializer
|
||||
}
|
||||
|
||||
const rawSymbol = Symbol('pino-raw-res-ref')
|
||||
const pinoResProto = Object.create({}, {
|
||||
statusCode: {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: 0
|
||||
},
|
||||
headers: {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: ''
|
||||
},
|
||||
raw: {
|
||||
enumerable: false,
|
||||
get: function () {
|
||||
return this[rawSymbol]
|
||||
},
|
||||
set: function (val) {
|
||||
this[rawSymbol] = val
|
||||
}
|
||||
}
|
||||
})
|
||||
Object.defineProperty(pinoResProto, rawSymbol, {
|
||||
writable: true,
|
||||
value: {}
|
||||
})
|
||||
|
||||
function resSerializer (res) {
|
||||
const _res = Object.create(pinoResProto)
|
||||
_res.statusCode = res.headersSent ? res.statusCode : null
|
||||
_res.headers = res.getHeaders ? res.getHeaders() : res._headers
|
||||
_res.raw = res
|
||||
return _res
|
||||
}
|
||||
|
||||
function mapHttpResponse (res) {
|
||||
return {
|
||||
res: resSerializer(res)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user