path
This commit is contained in:
		@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -4,14 +4,12 @@ export default defineEventHandler(async event => {
 | 
			
		||||
    // 获取图片
 | 
			
		||||
    if (event.node.req.method === 'GET') {
 | 
			
		||||
        // 判断当前执行目录是否存在 outputs 文件夹, 否则在上一级文件夹
 | 
			
		||||
        let path = `outputs/outputs/txt2img-samples/samples/${event.context.params.id}`
 | 
			
		||||
        let path = `outputs/txt2img-samples/samples/${event.context.params.id}`
 | 
			
		||||
        if (!fs.existsSync('outputs')) {
 | 
			
		||||
            path = `../outputs/outputs/txt2img-samples/samples/${event.context.params.id}`
 | 
			
		||||
            path = `../outputs/txt2img-samples/samples/${event.context.params.id}`
 | 
			
		||||
        }
 | 
			
		||||
        // 读取图片文件
 | 
			
		||||
        let image = fs.readFileSync(path)
 | 
			
		||||
        // 返回图片
 | 
			
		||||
        return image
 | 
			
		||||
        console.log('path:', path)
 | 
			
		||||
        return fs.readFileSync(path)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user