powr-sdk-api 1.3.4 → 1.4.1
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/middleware/notfound.js +18 -0
- package/package.json +2 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const logger = require("../logger");
|
|
4
|
+
// Handler for 404 Not Found errors
|
|
5
|
+
const notFoundHandler = (req, res) => {
|
|
6
|
+
// Log the 404 error
|
|
7
|
+
logger.warn(`Route not found: ${req.method} ${req.path}`, {
|
|
8
|
+
requestId: req.requestId,
|
|
9
|
+
ip: req.ip,
|
|
10
|
+
userAgent: req.headers['user-agent']
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// Return a consistent JSON response
|
|
14
|
+
return res.error('The requested resource was not found', 404, `${req.method} ${req.path}`);
|
|
15
|
+
};
|
|
16
|
+
module.exports = {
|
|
17
|
+
notFoundHandler
|
|
18
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powr-sdk-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Shared API core library for PowrStack projects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@aws-sdk/client-s3": "^3.787.0",
|
|
40
40
|
"express": "^4.18.2",
|
|
41
|
-
"jsonwebtoken": "^9.0.2",
|
|
41
|
+
"jsonwebtoken": "^9.0.2",
|
|
42
42
|
"swagger-jsdoc": "^6.2.8",
|
|
43
43
|
"swagger-ui-express": "^5.0.0",
|
|
44
44
|
"winston": "^3.17.0"
|