@vasrefil/api-toolkit 1.13.5 → 1.13.7
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.
|
@@ -34,17 +34,21 @@ class AdminAuthMidWare_ extends _root_service_1.RootService {
|
|
|
34
34
|
return async (req, res, next) => {
|
|
35
35
|
try {
|
|
36
36
|
const apiKey = req.headers['api-key'];
|
|
37
|
+
console.log('validate_auth_apiKey', apiKey);
|
|
37
38
|
if (apiKey) {
|
|
39
|
+
console.log('validate_auth_apiKey key found', apiKey);
|
|
38
40
|
if (apiKey !== valid_api_key)
|
|
39
41
|
throw user_response_1.UserApiResp.NO_API_KEY;
|
|
40
42
|
}
|
|
41
43
|
else {
|
|
44
|
+
console.log('validate_auth_else got here');
|
|
42
45
|
const { admin_user } = await this.get_admin(req);
|
|
43
46
|
req.admin = admin_user;
|
|
44
47
|
}
|
|
45
48
|
next();
|
|
46
49
|
}
|
|
47
50
|
catch (error) {
|
|
51
|
+
console.log('validate_auth_error', error);
|
|
48
52
|
const { status, message, data } = this.get_error(error);
|
|
49
53
|
return this.sendResponse({ req, res, status, actionType, message, data, error });
|
|
50
54
|
}
|
|
@@ -26,7 +26,7 @@ const routes = (app) => {
|
|
|
26
26
|
//use router middleware
|
|
27
27
|
app.use(router);
|
|
28
28
|
app.all('*', (req, res) => {
|
|
29
|
-
console.log(req.url);
|
|
29
|
+
console.log(`Method: ${req.method}, URL: ${req.url}`);
|
|
30
30
|
res.status(404).json({ status: 404, error: 'not found' });
|
|
31
31
|
});
|
|
32
32
|
};
|