move vector db debug endpoint to dev only

This commit is contained in:
timothycarambat 2024-03-27 13:19:28 -07:00
parent 99cfee1e70
commit bf8df60c02

View File

@ -51,6 +51,21 @@ developerEndpoints(app, apiRouter);
// Externally facing embedder endpoints // Externally facing embedder endpoints
embeddedEndpoints(apiRouter); embeddedEndpoints(apiRouter);
if (process.env.NODE_ENV !== "development") {
app.use(
express.static(path.resolve(__dirname, "public"), { extensions: ["js"] })
);
app.use("/", function (_, response) {
response.sendFile(path.join(__dirname, "public", "index.html"));
});
app.get("/robots.txt", function (_, response) {
response.type("text/plain");
response.send("User-agent: *\nDisallow: /").end();
});
} else {
// Debug route for development connections to vectorDBs
apiRouter.post("/v/:command", async (request, response) => { apiRouter.post("/v/:command", async (request, response) => {
try { try {
const VectorDb = getVectorDbClass(); const VectorDb = getVectorDbClass();
@ -78,20 +93,6 @@ apiRouter.post("/v/:command", async (request, response) => {
response.sendStatus(500).end(); response.sendStatus(500).end();
} }
}); });
if (process.env.NODE_ENV !== "development") {
app.use(
express.static(path.resolve(__dirname, "public"), { extensions: ["js"] })
);
app.use("/", function (_, response) {
response.sendFile(path.join(__dirname, "public", "index.html"));
});
app.get("/robots.txt", function (_, response) {
response.type("text/plain");
response.send("User-agent: *\nDisallow: /").end();
});
} }
app.all("*", function (_, response) { app.all("*", function (_, response) {