diff --git a/nuxt.config.ts b/nuxt.config.ts index 936e679..4af1dc9 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -2,7 +2,7 @@ export default defineNuxtConfig({ srcDir: 'src', devtools: { enabled: true }, - css: ['~/assets/css/main.css'], + css: ['@/assets/css/main.css'], modules: [ '@nuxt/ui', '@nuxtjs/tailwindcss' diff --git a/src/server/api/[...slug].post.ts b/src/server/api/[...slug].post.ts index 5b0251f..dc35e9d 100644 --- a/src/server/api/[...slug].post.ts +++ b/src/server/api/[...slug].post.ts @@ -30,9 +30,10 @@ export default defineEventHandler(async (event) => { // if the tool is already indexed and force is not true, return the tool let entry = await db.getToolsForUrl(url); - - // if the tool is already indexed and the last index time is less than 1 hour ago, return the tool - if (entry.tools.length > 0 && entry.lastIndexedAt && (Date.now() - Number(entry.lastIndexedAt)) < 3600000) { + + // if the tool is already indexed or if force is not set and the last index time is less than 1 hour ago, return the tool + const forceSetAndReady = getQuery(event).force && entry.lastIndexedAt && (Date.now() - Number(entry.lastIndexedAt)) < 3600000; + if (entry.tools.length > 0 && !forceSetAndReady) { // add headers to communicate that the response is cached and when it was last indexed setResponseHeader(event, "Content-Type", "application/json"); setResponseHeader(event, "Cached-Response", "true")