Skip to content

Runtime configuration

ตารางนี้ครอบคลุมหัวข้อหลักและตัวเลือกที่สำคัญจากเอกสาร โดยเน้นที่การสรุปข้อมูลอย่างกระชับ

ts
export default defineNitroConfig({
  runtimeConfig: {
    apiToken: "dev_token", // `dev_token` is the default value
    routeRules: {
	  '/blog/**': { swr: true },
	  '/blog/**': { swr: 600 },
	  '/blog/**': { static: true },
	  '/blog/**': { cache: { /* cache options*/ } },
	  '/assets/**': { headers: { 'cache-control': 's-maxage=0' } },
	  '/api/v1/**': { cors: true, headers: { 'access-control-allow-methods': 'GET' } },
	  '/old-page': { redirect: '/new-page' }, // uses status code 307 (Temporary Redirect)
	  '/old-page2': { redirect: { to:'/new-page2', statusCode: 301 } },
	  '/old-page/**': { redirect: '/new-page/**' },
	  '/proxy/example': { proxy: 'https://example.com' },
	  '/proxy/**': { proxy: '/api/**' },
	}
  }
})

Local development

shell
NITRO_API_TOKEN="123"

Production

shell
NITRO_API_TOKEN="123"

Released under the MIT License