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

#OBS-I222 : Resolved regexp route issue in express version 5 #247

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion api-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ app.use("/v2/", v2Router);
app.use("/", druidProxyRouter);
app.use("/alerts/v1", alertsRouter);
app.use("/", metricRouter);
// app.use("*", ResponseHandler.routeNotFound);
app.use(/(.*)/, ResponseHandler.routeNotFound);
app.use(obsrvErrorHandler);

app.listen(config.api_port, () => {
Expand Down
22 changes: 11 additions & 11 deletions api-service/src/routes/DruidProxyRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import { ResponseHandler } from "../helpers/ResponseHandler";
export const druidProxyRouter = express.Router();

// Send a 410 Gone response to all V1 API calls
// druidProxyRouter.all("/datasets/v1/*", ResponseHandler.goneResponse)
// druidProxyRouter.all("/dataset/v1/*", ResponseHandler.goneResponse)
// druidProxyRouter.all("/datasources/v1/*", ResponseHandler.goneResponse)
// druidProxyRouter.all("/data/v1/*", ResponseHandler.goneResponse)
// druidProxyRouter.all("/template/v1/*", ResponseHandler.goneResponse)
druidProxyRouter.all(/\/datasets\/v1(.*)/, ResponseHandler.goneResponse);
druidProxyRouter.all(/\/dataset\/v1(.*)/, ResponseHandler.goneResponse);
druidProxyRouter.all(/\/datasources\/v1(.*)/, ResponseHandler.goneResponse);
druidProxyRouter.all(/\/data\/v1(.*)/, ResponseHandler.goneResponse);
druidProxyRouter.all(/\/template\/v1(.*)/, ResponseHandler.goneResponse);

// // Druid Proxy APIs for Metabase integration
// druidProxyRouter.post(/\/druid\/v2.*/, setDataToRequestObject("query.wrapper.native.post"), onRequest({ entity: Entity.DruidProxy }), wrapperService.forwardNative)
// druidProxyRouter.get(/\/druid\/v2.*/, setDataToRequestObject("query.wrapper.native.get"), onRequest({ entity: Entity.DruidProxy }), wrapperService.forwardNativeGet)
// druidProxyRouter.delete("/druid/v2/:queryId", setDataToRequestObject("query.wrapper.native.delete"), onRequest({ entity: Entity.DruidProxy }), wrapperService.forwardNativeDel)
// druidProxyRouter.get("/status", setDataToRequestObject("query.wrapper.status"), onRequest({ entity: Entity.DruidProxy }), wrapperService.nativeStatus)
// druidProxyRouter.get("/health", setDataToRequestObject("api.health"), onRequest({ entity: Entity.DruidProxy }), healthService.checkDruidHealth)
// Druid Proxy APIs for Metabase integration
druidProxyRouter.post(/\/druid\/v2(.*)/, setDataToRequestObject("query.wrapper.native.post"), onRequest({ entity: Entity.DruidProxy }), wrapperService.forwardNative);
druidProxyRouter.get(/\/druid\/v2(.*)/, setDataToRequestObject("query.wrapper.native.get"), onRequest({ entity: Entity.DruidProxy }), wrapperService.forwardNativeGet);
druidProxyRouter.delete("/druid/v2/:queryId", setDataToRequestObject("query.wrapper.native.delete"), onRequest({ entity: Entity.DruidProxy }), wrapperService.forwardNativeDel)
druidProxyRouter.get("/status", setDataToRequestObject("query.wrapper.status"), onRequest({ entity: Entity.DruidProxy }), wrapperService.nativeStatus)
druidProxyRouter.get("/health", setDataToRequestObject("api.health"), onRequest({ entity: Entity.DruidProxy }), healthService.checkDruidHealth)