[{"data":1,"prerenderedAt":336},["ShallowReactive",2],{"content-query-9xvJEndm5n":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":7,"body":9,"_type":330,"_id":331,"_source":332,"_file":333,"_stem":334,"_extension":335},"\u002Fguides\u002Fdeploy","guides",false,"","Deploy บน Cloudflare",{"type":10,"children":11,"toc":324},"root",[12,20,27,95,109,114,125,158,163,185,191,228,255,260,265,318],{"type":13,"tag":14,"props":15,"children":17},"element","h1",{"id":16},"deploy-บน-cloudflare",[18],{"type":19,"value":8},"text",{"type":13,"tag":21,"props":22,"children":24},"h2",{"id":23},"ขึ้น-workers",[25],{"type":19,"value":26},"ขึ้น Workers",{"type":13,"tag":28,"props":29,"children":33},"pre",{"className":30,"code":31,"language":32,"meta":7,"style":7},"language-sh shiki shiki-themes github-dark","cd my-site\nnpx wrangler login\nnpm run deploy\n","sh",[34],{"type":13,"tag":35,"props":36,"children":37},"code",{"__ignoreMap":7},[38,56,76],{"type":13,"tag":39,"props":40,"children":43},"span",{"class":41,"line":42},"line",1,[44,50],{"type":13,"tag":39,"props":45,"children":47},{"style":46},"--shiki-default:#79B8FF",[48],{"type":19,"value":49},"cd",{"type":13,"tag":39,"props":51,"children":53},{"style":52},"--shiki-default:#9ECBFF",[54],{"type":19,"value":55}," my-site\n",{"type":13,"tag":39,"props":57,"children":59},{"class":41,"line":58},2,[60,66,71],{"type":13,"tag":39,"props":61,"children":63},{"style":62},"--shiki-default:#B392F0",[64],{"type":19,"value":65},"npx",{"type":13,"tag":39,"props":67,"children":68},{"style":52},[69],{"type":19,"value":70}," wrangler",{"type":13,"tag":39,"props":72,"children":73},{"style":52},[74],{"type":19,"value":75}," login\n",{"type":13,"tag":39,"props":77,"children":79},{"class":41,"line":78},3,[80,85,90],{"type":13,"tag":39,"props":81,"children":82},{"style":62},[83],{"type":19,"value":84},"npm",{"type":13,"tag":39,"props":86,"children":87},{"style":52},[88],{"type":19,"value":89}," run",{"type":13,"tag":39,"props":91,"children":92},{"style":52},[93],{"type":19,"value":94}," deploy\n",{"type":13,"tag":96,"props":97,"children":98},"p",{},[99,101,107],{"type":19,"value":100},"ได้ URL ",{"type":13,"tag":35,"props":102,"children":104},{"className":103},[],[105],{"type":19,"value":106},"*.workers.dev",{"type":19,"value":108}," ใช้งานได้ทันที",{"type":13,"tag":21,"props":110,"children":112},{"id":111},"ผูกโดเมนของตัวเอง",[113],{"type":19,"value":111},{"type":13,"tag":96,"props":115,"children":116},{},[117,119],{"type":19,"value":118},"เพิ่มใน ",{"type":13,"tag":35,"props":120,"children":122},{"className":121},[],[123],{"type":19,"value":124},"wrangler.toml",{"type":13,"tag":28,"props":126,"children":130},{"className":127,"code":128,"language":129,"meta":7,"style":7},"language-toml shiki shiki-themes github-dark","[[routes]]\npattern = \"your-domain.com\"\ncustom_domain = true\n","toml",[131],{"type":13,"tag":35,"props":132,"children":133},{"__ignoreMap":7},[134,142,150],{"type":13,"tag":39,"props":135,"children":136},{"class":41,"line":42},[137],{"type":13,"tag":39,"props":138,"children":139},{},[140],{"type":19,"value":141},"[[routes]]\n",{"type":13,"tag":39,"props":143,"children":144},{"class":41,"line":58},[145],{"type":13,"tag":39,"props":146,"children":147},{},[148],{"type":19,"value":149},"pattern = \"your-domain.com\"\n",{"type":13,"tag":39,"props":151,"children":152},{"class":41,"line":78},[153],{"type":13,"tag":39,"props":154,"children":155},{},[156],{"type":19,"value":157},"custom_domain = true\n",{"type":13,"tag":96,"props":159,"children":160},{},[161],{"type":19,"value":162},"แล้ว deploy อีกครั้ง",{"type":13,"tag":28,"props":164,"children":166},{"className":30,"code":165,"language":32,"meta":7,"style":7},"npm run deploy\n",[167],{"type":13,"tag":35,"props":168,"children":169},{"__ignoreMap":7},[170],{"type":13,"tag":39,"props":171,"children":172},{"class":41,"line":42},[173,177,181],{"type":13,"tag":39,"props":174,"children":175},{"style":62},[176],{"type":19,"value":84},{"type":13,"tag":39,"props":178,"children":179},{"style":52},[180],{"type":19,"value":89},{"type":13,"tag":39,"props":182,"children":183},{"style":52},[184],{"type":19,"value":94},{"type":13,"tag":21,"props":186,"children":188},{"id":187},"ตรวจหลัง-deploy",[189],{"type":19,"value":190},"ตรวจหลัง deploy",{"type":13,"tag":28,"props":192,"children":194},{"className":30,"code":193,"language":32,"meta":7,"style":7},"curl -I https:\u002F\u002Fyour-domain.com\ncurl https:\u002F\u002Fyour-domain.com\u002Fapi\u002Fhealth\n",[195],{"type":13,"tag":35,"props":196,"children":197},{"__ignoreMap":7},[198,216],{"type":13,"tag":39,"props":199,"children":200},{"class":41,"line":42},[201,206,211],{"type":13,"tag":39,"props":202,"children":203},{"style":62},[204],{"type":19,"value":205},"curl",{"type":13,"tag":39,"props":207,"children":208},{"style":46},[209],{"type":19,"value":210}," -I",{"type":13,"tag":39,"props":212,"children":213},{"style":52},[214],{"type":19,"value":215}," https:\u002F\u002Fyour-domain.com\n",{"type":13,"tag":39,"props":217,"children":218},{"class":41,"line":58},[219,223],{"type":13,"tag":39,"props":220,"children":221},{"style":62},[222],{"type":19,"value":205},{"type":13,"tag":39,"props":224,"children":225},{"style":52},[226],{"type":19,"value":227}," https:\u002F\u002Fyour-domain.com\u002Fapi\u002Fhealth\n",{"type":13,"tag":96,"props":229,"children":230},{},[231,233,239,241,247,249],{"type":19,"value":232},"บรรทัดแรกควรได้ ",{"type":13,"tag":35,"props":234,"children":236},{"className":235},[],[237],{"type":19,"value":238},"HTTP\u002F2 200",{"type":19,"value":240}," และ ",{"type":13,"tag":35,"props":242,"children":244},{"className":243},[],[245],{"type":19,"value":246},"\u002Fapi\u002Fhealth",{"type":19,"value":248}," ควรคืน ",{"type":13,"tag":35,"props":250,"children":252},{"className":251},[],[253],{"type":19,"value":254},"{\"ok\":true,...}",{"type":13,"tag":21,"props":256,"children":258},{"id":257},"เก็บคีย์ให้ปลอดภัย",[259],{"type":19,"value":257},{"type":13,"tag":96,"props":261,"children":262},{},[263],{"type":19,"value":264},"ห้ามใส่คีย์ในไฟล์ที่ขึ้น git ใช้ secret ของ Worker",{"type":13,"tag":28,"props":266,"children":268},{"className":30,"code":267,"language":32,"meta":7,"style":7},"npx wrangler secret put OPENAI_API_KEY\nnpx wrangler secret list\n",[269],{"type":13,"tag":35,"props":270,"children":271},{"__ignoreMap":7},[272,298],{"type":13,"tag":39,"props":273,"children":274},{"class":41,"line":42},[275,279,283,288,293],{"type":13,"tag":39,"props":276,"children":277},{"style":62},[278],{"type":19,"value":65},{"type":13,"tag":39,"props":280,"children":281},{"style":52},[282],{"type":19,"value":70},{"type":13,"tag":39,"props":284,"children":285},{"style":52},[286],{"type":19,"value":287}," secret",{"type":13,"tag":39,"props":289,"children":290},{"style":52},[291],{"type":19,"value":292}," put",{"type":13,"tag":39,"props":294,"children":295},{"style":52},[296],{"type":19,"value":297}," OPENAI_API_KEY\n",{"type":13,"tag":39,"props":299,"children":300},{"class":41,"line":58},[301,305,309,313],{"type":13,"tag":39,"props":302,"children":303},{"style":62},[304],{"type":19,"value":65},{"type":13,"tag":39,"props":306,"children":307},{"style":52},[308],{"type":19,"value":70},{"type":13,"tag":39,"props":310,"children":311},{"style":52},[312],{"type":19,"value":287},{"type":13,"tag":39,"props":314,"children":315},{"style":52},[316],{"type":19,"value":317}," list\n",{"type":13,"tag":319,"props":320,"children":321},"style",{},[322],{"type":19,"value":323},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":58,"depth":58,"links":325},[326,327,328,329],{"id":23,"depth":58,"text":26},{"id":111,"depth":58,"text":111},{"id":187,"depth":58,"text":190},{"id":257,"depth":58,"text":257},"markdown","content:guides:deploy.md","content","guides\u002Fdeploy.md","guides\u002Fdeploy","md",1793258342475]