Skip to content

اضبط مفتاح tls لتكوين TLS. كل من key و cert مطلوبان. يجب أن يكون key هو محتوى المفتاح الخاص بك؛ يجب أن يكون cert هو محتوى الشهادة الصادرة. استخدم Bun.file() لقراءة المحتويات.

ts
const server = Bun.serve({
  fetch: request => new Response("مرحبًا بك في Bun!"),
  tls: {
    cert: Bun.file("cert.pem"),
    key: Bun.file("key.pem"),
  },
});

بشكل افتراضي يثق Bun بقائمة Mozilla الافتراضية من جهات إصدار الشهادات الجذرية المعروفة. لتجاوز هذه القائمة، مرر مصفوفة من الشهادات كـ ca.

ts
const server = Bun.serve({
  fetch: request => new Response("مرحبًا بك في Bun!"),
  tls: {
    cert: Bun.file("cert.pem"),
    key: Bun.file("key.pem"),
    ca: [Bun.file("ca1.pem"), Bun.file("ca2.pem")],
  },
});

Bun بواسطة www.bunjs.com.cn تحرير