Do not version API. Premature given current state of the codebase

- Reason
  - All clients that currently consume the API are part of Khoj
  - Any breaking API changes will be fixed in clients immediately
  - So decoupling client from API is not required
  - This removes the burden of maintaining muliple versions of the API
This commit is contained in:
Debanjum Singh Solanky
2022-10-08 13:16:08 +03:00
parent 2c548133f3
commit d292bdcc11
9 changed files with 34 additions and 34 deletions

View File

@@ -10,7 +10,7 @@ var emptyValueDefault = "🖊️";
/**
* Fetch the existing config file.
*/
fetch("/api/v1.0/config/data")
fetch("/api/config/data")
.then(response => response.json())
.then(data => {
rawConfig = data;
@@ -26,7 +26,7 @@ fetch("/api/v1.0/config/data")
configForm.addEventListener("submit", (event) => {
event.preventDefault();
console.log(rawConfig);
fetch("/api/v1.0/config/data", {
fetch("/api/config/data", {
method: "POST",
credentials: "same-origin",
headers: {
@@ -46,7 +46,7 @@ regenerateButton.addEventListener("click", (event) => {
event.preventDefault();
regenerateButton.style.cursor = "progress";
regenerateButton.disabled = true;
fetch("/api/v1.0/update?force=true")
fetch("/api/update?force=true")
.then(response => response.json())
.then(data => {
regenerateButton.style.cursor = "pointer";

View File

@@ -77,8 +77,8 @@
// Generate Backend API URL to execute Search
url = type === "image"
? `/api/v1.0/search?q=${encodeURIComponent(query)}&t=${type}&n=${results_count}`
: `/api/v1.0/search?q=${encodeURIComponent(query)}&t=${type}&n=${results_count}&r=${rerank}`;
? `/api/search?q=${encodeURIComponent(query)}&t=${type}&n=${results_count}`
: `/api/search?q=${encodeURIComponent(query)}&t=${type}&n=${results_count}&r=${rerank}`;
// Execute Search and Render Results
fetch(url)
@@ -94,7 +94,7 @@
function updateIndex() {
type = document.getElementById("type").value;
fetch(`/api/v1.0/update?t=${type}`)
fetch(`/api/update?t=${type}`)
.then(response => response.json())
.then(data => {
console.log(data);
@@ -118,7 +118,7 @@
function populate_type_dropdown() {
// Populate type dropdown field with enabled search types only
var possible_search_types = ["org", "markdown", "ledger", "music", "image"];
fetch("/api/v1.0/config/data")
fetch("/api/config/data")
.then(response => response.json())
.then(data => {
document.getElementById("type").innerHTML =