expresso-macchiato 0.4.5-dev.1 → 0.4.5-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -2
- package/dist/index.mjs +8 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -666,10 +666,16 @@ var RouterWrapper = class {
|
|
|
666
666
|
const handlerRes = await currentMethod.handler(req, res);
|
|
667
667
|
console.log(`Handling res on [${method}] ${this.data.basePath}${path3}`, JSON.stringify(handlerRes));
|
|
668
668
|
if (handlerRes.contentType) {
|
|
669
|
+
console.log(`[${method}] ${this.data.basePath}${path3} CONTENTTYPE`);
|
|
669
670
|
res.set("Content-Type", handlerRes.contentType);
|
|
670
671
|
res.status(_nullishCoalesce(handlerRes.status, () => ( 200))).send(handlerRes.result);
|
|
671
|
-
} else if (typeof handlerRes.result === "object")
|
|
672
|
-
|
|
672
|
+
} else if (typeof handlerRes.result === "object") {
|
|
673
|
+
console.log(`[${method}] ${this.data.basePath}${path3} OBJECT`);
|
|
674
|
+
res.status(_nullishCoalesce(handlerRes.status, () => ( 200))).json(handlerRes.result);
|
|
675
|
+
} else {
|
|
676
|
+
console.log(`[${method}] ${this.data.basePath}${path3} OTHER`);
|
|
677
|
+
res.status(_nullishCoalesce(handlerRes.status, () => ( 200))).send(handlerRes.result);
|
|
678
|
+
}
|
|
673
679
|
} catch (err) {
|
|
674
680
|
fullLogNok("api", `[${method}] ${this.data.basePath}${path3} => ${_nullishCoalesce(err.message, () => ( err))}`);
|
|
675
681
|
res.status(500).send(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _41 => _41.message]), () => ( err)));
|
package/dist/index.mjs
CHANGED
|
@@ -666,10 +666,16 @@ var RouterWrapper = class {
|
|
|
666
666
|
const handlerRes = await currentMethod.handler(req, res);
|
|
667
667
|
console.log(`Handling res on [${method}] ${this.data.basePath}${path3}`, JSON.stringify(handlerRes));
|
|
668
668
|
if (handlerRes.contentType) {
|
|
669
|
+
console.log(`[${method}] ${this.data.basePath}${path3} CONTENTTYPE`);
|
|
669
670
|
res.set("Content-Type", handlerRes.contentType);
|
|
670
671
|
res.status(handlerRes.status ?? 200).send(handlerRes.result);
|
|
671
|
-
} else if (typeof handlerRes.result === "object")
|
|
672
|
-
|
|
672
|
+
} else if (typeof handlerRes.result === "object") {
|
|
673
|
+
console.log(`[${method}] ${this.data.basePath}${path3} OBJECT`);
|
|
674
|
+
res.status(handlerRes.status ?? 200).json(handlerRes.result);
|
|
675
|
+
} else {
|
|
676
|
+
console.log(`[${method}] ${this.data.basePath}${path3} OTHER`);
|
|
677
|
+
res.status(handlerRes.status ?? 200).send(handlerRes.result);
|
|
678
|
+
}
|
|
673
679
|
} catch (err) {
|
|
674
680
|
fullLogNok("api", `[${method}] ${this.data.basePath}${path3} => ${err.message ?? err}`);
|
|
675
681
|
res.status(500).send(err?.message ?? err);
|