Tüm Rehberler

Deno Kurulumu

Deno JavaScript/TypeScript runtime'ını kurun. Güvenli ve modern alternatif.

Başlangıç10 dk

Kurulum Adımları

1. Deno'yu kurun:

curl -fsSL https://deno.land/install.sh | sh

2. PATH'e ekleyin (.bashrc):

export DENO_INSTALL="$HOME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

3. Versiyonu kontrol edin:

deno --version

4. TypeScript dosyası çalıştırın:

deno run index.ts

5. İzinler ile çalıştırma:

deno run --allow-net --allow-read server.ts

6. HTTP sunucusu örneği:

typescript
Deno.serve({ port: 8000 }, (req) => {
  return new Response("Merhaba Deno!")
})

7. Paket yönetimi (deno.json):

{
  "imports": {
    "oak": "https://deno.land/x/oak/mod.ts"
  }
}

8. Test yazma:

typescript
Deno.test("toplama testi", () => {
  const result = 2 + 3
  if (result !== 5) throw new Error("Hata!")
})

9. Test çalıştırma:

deno test

10. Deno Deploy ile yayınlama:

deno install -Agf jsr:@deno/deployctl
deployctl deploy --project=proje-adi main.ts