Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/cache spec on boot #189

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
af7e86f
Added: Feature for create cache on load
shreyvishal Jun 17, 2024
cb80785
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
66332c6
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
3ce6979
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
aab4737
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
df9d50c
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
7897d9a
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
1b1c85b
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
7ea9829
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
e47dc10
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
282c724
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
3fff448
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
6d1f612
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
049acd4
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
ba9e1a1
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
e29fcda
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
01b7d0c
Added: Feature For load OpenAPIValidator Cache on app boot
shreyvishal Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
"dotenv": "^16.4.1",
"express": "^4.18.1",
"express-openapi-validator": "^5.1.6",
"yaml": "^2.4.2",
"ioredis": "^5.0.6",
"libsodium-wrappers": "^0.7.9",
"mongodb": "^4.7.0",
"node-mocks-http": "^1.14.1",
"request-ip": "^3.3.0",
"uuid": "^8.3.2",
"winston": "^3.7.2",
"winston-daily-rotate-file": "^4.7.1",
"yaml": "^2.4.2",
"zod": "^3.14.2"
}
}
28 changes: 15 additions & 13 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Exception } from "./models/exception.model";
import {
BecknErrorDataType,
becknErrorSchema,
BecknErrorType,
BecknErrorType
} from "./schemas/becknError.schema";
import { RequestActions } from "./schemas/configs/actions.app.config.schema";
import { LookupCache } from "./utils/cache/lookup.cache.utils";
Expand All @@ -16,12 +16,13 @@ import { ClientUtils } from "./utils/client.utils";
import { getConfig } from "./utils/config.utils";
import { GatewayUtils } from "./utils/gateway.utils";
import logger from "./utils/logger.utils";
import { OpenApiValidatorMiddleware } from "./middlewares/schemaValidator.middleware";

const app = Express();

app.use(
Express.json({
limit: "200kb",
limit: "200kb"
})
);

Expand All @@ -35,13 +36,13 @@ const initializeExpress = async (successCallback: Function) => {
origin: "*",
optionsSuccessStatus: 200,
credentials: true,
methods: ["GET", "PUT", "POST", "PATCH", "DELETE", "OPTIONS"],
methods: ["GET", "PUT", "POST", "PATCH", "DELETE", "OPTIONS"]
})
);
app.use(
cors({
origin: "*",
methods: ["GET", "PUT", "POST", "PATCH", "DELETE", "OPTIONS"],
methods: ["GET", "PUT", "POST", "PATCH", "DELETE", "OPTIONS"]
})
);

Expand All @@ -50,10 +51,10 @@ const initializeExpress = async (successCallback: Function) => {
Express.json({
verify: (req: Request, res: Response, buf: Buffer) => {
res.locals = {
rawBody: buf.toString(),
rawBody: buf.toString()
};
},
limit: "200kb",
limit: "200kb"
})
);

Expand Down Expand Up @@ -83,24 +84,24 @@ const initializeExpress = async (successCallback: Function) => {
code: err.code,
message: err.message,
data: err.errorData,
type: BecknErrorType.domainError,
type: BecknErrorType.domainError
} as BecknErrorDataType;
res.status(err.code).json({
message: {
ack: {
status: "NACK",
},
status: "NACK"
}
},
error: errorData,
error: errorData
});
} else {
res.status(err.code || 500).json({
message: {
ack: {
status: "NACK",
},
status: "NACK"
}
},
error: err,
error: err
});
}
});
Expand Down Expand Up @@ -131,6 +132,7 @@ const main = async () => {
getConfig().app.gateway.mode.toLocaleUpperCase().substring(1)
);
});
await OpenApiValidatorMiddleware.getInstance().initOpenApiMiddleware();
} catch (err) {
if (err instanceof Exception) {
logger.error(err.toString());
Expand Down
Loading
Loading