From a958bab60a083dcfab5b196c8124471862c347f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=9C=E8=8F=AF?= Date: Sun, 19 Feb 2023 04:30:18 +0800 Subject: [PATCH] DEBUG dir --- nuxt.config.ts | 14 +++++++------- server/api/img/[id].ts | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 6e4a027..784c8ae 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -13,13 +13,13 @@ export default defineNuxtConfig({ } } }, - //nitro: { - // devProxy: { - // '/api': { - // target: 'http://106.15.192.42:3000/api' - // } - // }, - //}, + nitro: { + devProxy: { + '/api': { + target: 'http://106.15.192.42:3000/api' + } + }, + }, //devServer: { // host: '106.15.192.42', // port: 3000, diff --git a/server/api/img/[id].ts b/server/api/img/[id].ts index 796db2d..450c2f6 100644 --- a/server/api/img/[id].ts +++ b/server/api/img/[id].ts @@ -6,7 +6,9 @@ export default defineEventHandler(async event => { // 判断当前执行目录是否存在 outputs 文件夹, 否则在上一级文件夹 let path = `outputs/txt2img-samples/samples/${event.context.params.id}` if (!fs.existsSync('outputs')) { - path = `../outputs/txt2img-samples/samples/${event.context.params.id}` + // 打印当前执行目录 + console.log('cwd:', process.cwd()) + path = `../../outputs/txt2img-samples/samples/${event.context.params.id}` } console.log('path:', path) return fs.readFileSync(path)