expresso-macchiato 0.4.5-dev.2 → 0.4.6
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 +2 -9
- package/dist/index.mjs +2 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -664,18 +664,11 @@ var RouterWrapper = class {
|
|
|
664
664
|
const callBackFunction = async (req, res) => {
|
|
665
665
|
try {
|
|
666
666
|
const handlerRes = await currentMethod.handler(req, res);
|
|
667
|
-
console.log(`Handling res on [${method}] ${this.data.basePath}${path3}`, JSON.stringify(handlerRes));
|
|
668
667
|
if (handlerRes.contentType) {
|
|
669
|
-
console.log(`[${method}] ${this.data.basePath}${path3} CONTENTTYPE`);
|
|
670
668
|
res.set("Content-Type", handlerRes.contentType);
|
|
671
669
|
res.status(_nullishCoalesce(handlerRes.status, () => ( 200))).send(handlerRes.result);
|
|
672
|
-
} else if (typeof handlerRes.result === "object")
|
|
673
|
-
|
|
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
|
-
}
|
|
670
|
+
} else if (typeof handlerRes.result === "object") res.status(handlerRes.status).json(handlerRes.result);
|
|
671
|
+
else res.status(handlerRes.status).send(handlerRes.result);
|
|
679
672
|
} catch (err) {
|
|
680
673
|
fullLogNok("api", `[${method}] ${this.data.basePath}${path3} => ${_nullishCoalesce(err.message, () => ( err))}`);
|
|
681
674
|
res.status(500).send(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _41 => _41.message]), () => ( err)));
|
package/dist/index.mjs
CHANGED
|
@@ -664,18 +664,11 @@ var RouterWrapper = class {
|
|
|
664
664
|
const callBackFunction = async (req, res) => {
|
|
665
665
|
try {
|
|
666
666
|
const handlerRes = await currentMethod.handler(req, res);
|
|
667
|
-
console.log(`Handling res on [${method}] ${this.data.basePath}${path3}`, JSON.stringify(handlerRes));
|
|
668
667
|
if (handlerRes.contentType) {
|
|
669
|
-
console.log(`[${method}] ${this.data.basePath}${path3} CONTENTTYPE`);
|
|
670
668
|
res.set("Content-Type", handlerRes.contentType);
|
|
671
669
|
res.status(handlerRes.status ?? 200).send(handlerRes.result);
|
|
672
|
-
} else if (typeof handlerRes.result === "object")
|
|
673
|
-
|
|
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
|
-
}
|
|
670
|
+
} else if (typeof handlerRes.result === "object") res.status(handlerRes.status).json(handlerRes.result);
|
|
671
|
+
else res.status(handlerRes.status).send(handlerRes.result);
|
|
679
672
|
} catch (err) {
|
|
680
673
|
fullLogNok("api", `[${method}] ${this.data.basePath}${path3} => ${err.message ?? err}`);
|
|
681
674
|
res.status(500).send(err?.message ?? err);
|