Skip to content

gungunfebrianza/Belajar-Dengan-Jenius-DenoTheWKWKLand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Belajar Dengan Jenius Deno

Table of Contents

  • Open Library Indonesia

  • Metode Belajar

    • Learning Problems & Abstraction Control
  • Matthew Effect in Reading

  • Persiapan

    • Apa saja yang harus dipersiapkan?
      • Install Node.js
      • Install Visual Studio Code
      • Install Python
      • Install Google Chrome atau Firefox
      • Install Git
      • Install Postman
    • Konvensi Penulisan?
    • Feedback?
    • Kode Sumber?
    • Penggunaan Kode?
    • Terdapat Kesalahan?
    • Pertanyaan, Kritik dan Saran?
  • Chapter 1

    • Belajar Open Web Platform
    • Subchapter 1 - Apa itu Open Web Platform
      • 1. Technical Specification
      • 2. HTML 5.2
        • Semantic Advantage
        • Connectivity Advantage
        • Storage Advantage
        • Multimedia Advantage
        • Performance Advantage
        • Device Access Advantage
        • Specification
      • 3. Web Assembly
        • Safe
        • Fast
        • Portable Code
        • Compact Code
        • Specification
      • 4. EcmaScript
        • Specification
      • 5. Web Socket
        • Specification
        • Application
      • 6. WebRTC
        • Specification
        • Application
      • 7. WebGL
        • Specification
        • Application
    • Subchapter 2 - Apa itu Web Application?
      • 1. Server
        • File Server
        • Mail Server
        • Proxy Server
        • Application Server
        • Database Server
        • Messaging Server
      • 2. Virtual Private Server
        • Virtualization
        • Virtual Machine
        • Hypervisor
      • 3. Web Server
      • 4. Web Page
        • Static Web Page
        • Dynamic Web Page
        • Progressive Web Application (PWA)
        • Single Page Application (SPA)
      • 5. Network
        • Local Area Network (LAN)
        • World Area Network (WAN)
        • Internet Service Provide (ISP)
      • 6. Internet
        • Internet Transit
        • Satellite & Fiber Optic
      • 7. Internet Exchange Point
      • 8. Content Delivery Network (CDN)
      • 9. Cloud Computing
        • Cloud Computing Execution Model
        • Cloud Service Provider
        • Scalability
        • Load Balancer
      • 10. Serverless Computing
        • FaaS Provider
        • AWS Lambda
    • Subchapter 3 - Bedah Konsep HTTP
      • 1. HTTP & URL
        • HTTP
        • Hypertext & Hyperlink
        • Hypermedia
        • World Wide Web (www)
        • Uniform Resources Identifier (URI)
        • URL / Web Resources
      • 2. HTTP & DNS
        • IP Address
        • DNS Resolver
        • Root Server & TLD Server
      • 3. HTTP Transaction
        • TCP Three-way Handshake
      • 4. HTTP Request
        • HTTP Method
        • Message
        • HTTP Header
        • Header Attribute
        • MIME
      • 5. HTTP Response
      • 6. HTTP Status Message
    • Subchapter 4 - Web Security
      • 1. Data in The Low Level
        • Host
        • Socket
        • Bit
        • Byte
        • Bytes
        • Character
        • ASCII
        • Data Transmission
        • Base64 Encoding
      • 2. Cryptography
        • Cryptoanalysis
        • Information Security
        • Ciphertext
        • Symmetric Cryptography
        • Hash Function
        • Message Authentication Codes (MAC)
        • Asymmetric Cryptography
        • Cryptography Protocol
      • 3. Man In The Middle (MITM) Attack
        • Eavesdropping
      • 4. HTTPS
        • Perbedaan HTTP & HTTPS
        • Manfaat HTTPS
      • 5. Secure Socket Layer (SSL)
        • Transport Socket Layer (TLS)
        • SSL Handshake
  • Chapter 2

    • Setup Learning Environment
    • Subchapter 1 - Visual Studio Code
      • 1. Install Programming Language Support
      • 2. Install Keybinding
      • 3. Install & Change Theme Editor
      • 4. The File Explorer
      • 5. Search Feature
      • 6. Source Control
      • 7. Debugger
      • 8. Extension
        • Deno
        • Auto Fold
        • Better Comment
        • Bookmarks
        • Javascript (ES6) Code Snippets
        • Path Intellisense
        • VSCode Great Icons
      • 9. The Terminal
        • Menambah Terminal Baru
        • Melakukan Split Terminal
        • Mengubah Posisi Terminal
        • Menghapus Terminal
      • 10. Performance Optimization
      • 11. Zen Mode
      • 12. Display Multiple File
      • 13. Font Ligature
    • Subchapter 2 - Web Browser
      • 1. Web Browser
      • 2. Web Console
        • Autocomplete
        • Syntax Highlighting
        • Execution History
      • 3. Multiline Code Editor
  • Chapter 3

    • Mastering Deno
    • Subchapter 1 - Install Deno
    • Subchapter 2 - Introduction to Deno
      • 1. Why Deno?
        • Promise Dilemma
        • Security
        • The Build System (GYP)
        • Package.json
        • Node Modules
        • Module & Extension
        • Index.js
      • 2. Deno Runtime
        • Typescript
        • Package Manager
        • Browser Object Support
        • Built-in Tooling
        • Sandbox
      • 3. Deno Infrastructure
        • Deno Front-end
        • Deno Middle-end
        • Deno Back-end
      • 4. Deno Program
      • 5. Deno Command
      • 6. Deno Standard Module
        • Module fs
        • Module http
        • Module datetime
        • Module node
        • Module ws
      • 7. Deno Third-party Modules
    • Subchapter 3 - Introduction to Typescript
      • 1. Javascript
      • 2. Node.js
      • 3. Typescript
        • Compilation
        • Static Typing
        • Typescript Compiler
        • Compile Typescript
        • Typescript Compiler Options
        • Typescript Playground
    • Subchapter 4 - Fundamental Deno
      • 1. Deno Task Runner
        • Edit Environment Variable
        • Create Training Directory
        • Create Index.ts
      • 2. Hello World
      • 3. Comment
      • 4. Variable Declaration
        • Variable
        • Binding
        • Reserver World
        • Naming Convention
        • Case Sensitivity
        • Loosely Typed Language
        • Typescript Static Typing
        • Var Keyword
        • Let Keyword
        • Constant Keyword
      • 5. Expression & Operator
        • Statement
        • Expression
        • Operator & Operand
        • Operator Precedence
        • Arithmatic Operation
        • Comparison Operator
        • Logical Operator
        • Assignment Operator
      • 6. Javascript Strict Mode
        • Legacy Code
      • 7. Automatic Add Semicolon
      • 8. Clean Code Variable Declaration
        • Avoid Global Variable
        • Declaration on Top
    • Subchapter 5 - Deno Data Types
      • 1. Javascript Data Types
        • Apa itu Data?
        • Apa itu Types?
        • Apa itu Generic Variable?
        • Javascript Data Types
        • Apa itu Pointer?
        • Apa itu Stack & Heap?
        • Primitive Types
        • Apa itu Primitive & Reference Values?
        • Reference Types
        • Primitive as Object via Object Wrapper
      • 2. Typescript Data Type
        • Typescript Type Annotation
        • Declare Explicit
        • Declare Implicit
      • 3. String Data Types
        • String Type
        • Template String
        • Escaping
        • String Concatenation
        • String Interpolation
        • String Object
        • String Property
        • String Methods
      • 4. Number Data Types
        • Number Type
        • Infinity
        • NaN
        • Number Object
        • Number Property
        • Number Methods
        • Number Accuration
        • Imprecise Calculation
        • Solution to Imprecise
        • Fixed Number
        • Numeric Conversion
        • Math Object
        • Hexadecimal, Binary dan Octadecimal
      • 5. Booleans Data Types
        • Boolean Type
      • 6. Inferred Type
        • Dynamic Typed
        • Static Typed
      • 7. Type Conversion
        • String To Number
        • String To Decimal Number
        • Number to String
        • Decimal Number to String
        • Boolean to String
      • 8. Check Data Type
        • Primitive Types
        • Reference Types
      • 9. Any Type
        • Parameter Any Type
        • Option nolmplicitAny
      • 10. Type Union
        • Parameter Union Type
      • 11. Symbol Type
      • 12. Type Widening
        • Undefined
        • Null
        • Option strictNullCheck
      • 13. BigInt Data Types
        • Arbitary Precision
        • Arithmetic Operation
        • Comparison
      • 14. Custom Type
      • 15. Clean Code Data Types
        • Declare Primitive Not Object
    • Subchapter 6 - Control Flow
      • 1. Block Statements
      • 2. Conditional Statemnets
      • 3. Ternary Operator
      • 4. Multiconditional Statement
      • 5. Switch Style
    • Subchapter 7 - Loop & Iteration
      • 1. While Statement
      • 2. Do ... While Statement
      • 3. For Statement
      • 4. For ... Of
      • 5. For ... in
      • 6. Break Statement
      • 7. Continue Statement
      • 8. Labeled Statement
    • Subchapter 8 - Function
      • 1. Apa itu Function?
        • Function Declaration
        • Function Expression
      • 2. First-class Function
        • What is Excecution Context (EC)?
      • 3. Simple Function
        • Typescript Version
      • 4. Function Parameter
        • Parameter Type
        • Optional Parameter
        • Default Parameter
        • Rest Parameter
      • 5. Function Return
      • 6. Function For Function Parameter
      • 7. Function & Outer Variable
      • 8. Function & Outer Variable
      • 9. Callback Function
      • 10. Arrow Function
      • 11. Multiline Arrow Function
      • 12. Anonymous Function
      • 13. Function Constructor
      • 14. Function As Expression
      • 15. Nested Function
      • 16. Argument Object
      • 17. This Keyword
        • Implicit Binding
      • 18. Call & Apply Function
        • Explicit Binding
        • Call
        • Apply
      • 19. IIFE
      • 20. Clean Code Function
        • Always Declare Local Variable
        • Use Named Function Expression
        • Use Default Parameter
        • Function is not statement
    • Subchapter 9 - Error Handling
      • 1. Syntax Error
        • Missing Syntax
        • Invalid Syntax
      • 2. Logical Error
      • 3. Runtime Error
        • Reference Error
        • Range Error
        • Type Error
        • Syntax Error
      • 4. Try & Catch
        • Error Object Properties
        • Stact Trace
        • Finally
      • 5. Custom Error
    • Subchapter 10 - Object
      • 1. Apa itu Fundamental Objects?
      • 2. Custom Object
        • Object Initializer
        • Object Property
        • Object Method
        • Object Constructor
        • Function Constructor
        • Object Prototype
        • Getter & Setter
        • Object Destructure
        • Typescript Type Template
        • Complex Object Type
      • 3. Custom Object Property
        • Add Object Property
        • Access Object Property
        • Delete Object Property
        • Check Object Properry
      • 4. Custom Object Method
        • Access Object Method
        • Add Object Method
      • 5. Custom Object Looping
      • 6. JSON
        • JSON & Object Literal
        • Stringify
        • Parse JSON
        • Parse Date in JSON
    • Subchapter 11 - Classes
      • 1. Class-based language
        • Function Constructor
        • Class ECMAScript2015
        • Class Typescript
      • 2. Class Inheritance
      • 3. Class Access Modifier
        • Public
        • Private
        • Protected
        • Public Behaviour
        • Protected Behaviour
        • Private Behaviour
        • Readonly Property
      • 4. Class Constructor
        • Spread Argument
      • 5. Static Keyword
      • 6. Super Method
      • 7. Method Override
      • 8. Accessor Getter & Setter
      • 9. Abstract Class
      • 10. Class Declaration
    • Subchapter 12 - Interface
      • 1. Design Interface
        • Create Malware Interface
        • Implement Malware Interface
        • Class Type & Interface Type
        • Create Ransomware Interface
        • Implement Ransomware Interface
        • Interface Extend Multi-Interface
        • Create Trojan Interface
        • Implement Multi-interface
      • 2. Interface & Class
        • Interface Extends Interface
        • Interface Extends Class
        • Interface Cant Implement Interface
        • Interface Implements Class
        • Class Cant Extends Interface
        • Class Implements Class
    • Subchapter 13 - Collection
      • 1. Apa itu Collection?
        • Iterable
        • Keyed
        • Destructurable
      • 2. Apa itu Indexed Collections?
        • Array
        • Create Array
        • Array Property & Method
      • Array Properties
        • Multidimensional Array
        • Matrix
        • Multi-type Array
        • Array of Interface
      • 3. Keyed Collections
        • Map
        • Set
    • Subchapter 14 - Tuples
      • Create Tuple
      • Tuple Property & Method
      • Application
    • Subchapter 15 - Enum
      • 1. Create Enum
      • 2. Access Enum
      • 3. Enum Function Argument
    • Subchapter 16 - Generic
      • 1. Generic Function
        • Type Union Way
        • Generic Type
      • 2. Reverse Array Element
        • Create Generic Function
        • Create Parameter For Generic Function
        • Create Return For Generic Function
        • Create Internal Array Data Structure
        • Create Internal Algorithm
        • Create Return Inside Generic Function
    • Subchapter 17 - Module
      • 1. Module Concept
        • Module
        • Module Format
        • Module Loaders
        • Module Bundlers
      • 2. Node.js Module
        • Create & Export Module
        • Use Module
        • Export Multiple Method & Value
        • Export Style
        • Destructure Assignment
        • Export Class
      • 3. Deno Module
        • Create & Export Module
        • Use Module
        • Compile to Javascript
        • Export Visualization
        • Import Module
    • Subchapter 18 - Namespace
      • 1. Create Namespace
        • Nested Namespace
        • Namespace Reference
      • 2. Application - Stack Data Structure
        • Stack Data Structure
        • Create Interface Data Structure
        • Create Class Stack Data Structure
        • Create Stack Object
        • Access Peek Method
        • Access Push Method
        • Access Pop Method
      • 3. Application - Queue Data Structure
        • Queue Data Structure
        • Create Interface Data Structure
        • Create Class Queue Data Structure
        • Create Queue Object
        • Access Peek Method
        • Access Enqueue Method
        • Access Dequeue Method
  • Chapter 4

    • Deno Standard Module
    • Subchapter 1 - Filesystem Programming
      • 1. File & Directory
        • Create Directory
        • Check Directory
        • Delete Directory Content
        • Move File & Directory
        • Copy File & Directory
        • WriteJson
        • ReadJson
        • writeFileStr
        • readFileStr
        • Walk
    • Subchapter 2 - HTTP Server
    • Subchapter 3 - Testing
      • 1. Why Software Testing
      • 2. Type of Software Testing
        • Bug
        • Defect Level
        • Functional Testing
        • Unit Testing
        • Code Refactoring
        • Code Coverage
        • Integration Testing
        • System Testing
        • User Acceptance Testing
        • Alpha & Beta Testing
      • 3. Deno Testing
        • Assertion
        • assert Function
        • equal Function
      • 4. Deno Benchmarking
        • bench Function
        • runBenchmarks Function
    • Subchapter 4 - Debugging
  • Chapter 5

    • REST API
    • Subchapter 1 - Oak Framework
      • 1. Create Basic Server
        • Class Application
        • Register Middleware
        • Start Listening
      • 2. Middleware
        • Control Execution
        • Context Object
        • Cookies
        • Request
        • Request Properties
        • Request Headers
        • Request Methods
        • Response
        • Response Properties
        • Response Methods
      • 3. Routing
        • Class Router
        • Route Method
        • Route Path
        • Route Parameter
        • Route Handler
        • Register Route Middleware
      • 4. Error Handling
        • Function isHttpError
        • Enum Status
        • Try & Catch
      • 5. Static Content
    • Subchapter 2 - Introduction to Database
      • 1. Database Function
        • Data Management
        • Scalability
        • Data Heterogenity
        • Efficiency
        • Persistence
        • Realiability
        • Consistency
        • Non-redundancy
      • 2. Use Case Database
      • 3. Data Analytic
    • Subchapter 3 - PostgreSQL
      • 1. Create Basic Server
      • 2. Database Administration
    • Subchapter 4 - BlogApp
  • Chapter 6

    • Mastering Node.js
    • Subchapter 1 - Node.js
      • 1. Node.js System
        • Test Node.js Executable
      • 2. I/O Scaling Problem
      • 3. Process & Thread
        • Multithread
      • 4. Core Modules & libuv
    • Subchapter 2 - V8 Javascript Engine
      • 1. The Call Stack
        • Synchronous Program
        • Asynchronous Program
        • Event Loops
        • Blocking
        • Non-blocking
      • 2. Javascript Compilation Pipeline
        • Interpreter & Compiler
        • Machine Code
        • Ignition & Turbofan
        • Intermediate Representation (IR)
        • Bytecode
        • Just-in-Time Compilation
        • Compiler Development Philosophy
      • 3. Memory Management
        • Memory Lifecycle
        • Allocation Example
        • Garbage Collector
        • Mark-and-Sweep Algorithm
    • Subchapter 3 - Node.js Application
      • 1. Running Javascript File
      • 2. Node RPL
      • 3. Package Manager
      • 4. Node Package Manager
        • NPM commands
      • 5. Node Package Registry
      • 6. Create Node.js Package
        • package.json
        • Directive
        • Search Package
        • Install Package
        • Remove Package
        • View Package
        • Publish Package
        • Create Package
      • 7. Publish Node.js Package
      • 8. Node.js Application
    • Subchapter 4 - Debugging Node.js
      • 1. Debug on Visual Studio Code
      • 2. Built-in Node.js Debugger
    • Subchapter 5 - Asynchronous
      • 1. Callback
      • 2. Promise
        • Promise Constructor
        • Resolve
        • Reject
        • Example Promise
      • 3. Fetch
        • Fetch Kawal Corona
        • Promise Chaining
      • 4. Fetch Async Await
        • Async Function
        • Await
        • Error Handling
      • 5. Top Level Await
  • Daftar Pustaka

  • Tentang Penulis

  • Other Examples

  • Contributor

Lets Destroy Node.js developer.

"When you are designing a program there are things that might be cute to add in, you always regret those."

Ryan Dahl - 10 Things i Regret About Node.js @ JSConf Europe

Installation

Install Deno For Windows

Kita akan melakukan instalasi Deno menggunakan Package Manager yang disebut dengan Chocolatey :

1. Install Chocolatey Package Manager

Jalankan Powershell (run as administrator), kemudian eksekusi perintah di bawah ini :

Setelah itu eksekusi perintah powershell di bawah ini :

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Proses instalasi sedang di lakukan, kita akan memiliki directory Chocolatey Package Repository di :

C:\ProgramData\chocolatey\lib

Kita juga akan memiki directory untuk Chocolatey Binary di :

C:\ProgramData\chocolatey\bin

Pastikan chocholatey sudah terpasang dengan cara mengeksekusi perintah di bawah ini dalam cmd.exe :

choco

Maka informasi versi choco akan di tampilkan :

Chocolatey v0.10.15

2. Install Deno Via Package Manager

Lakukan instalasi Deno menggunakan perintah di bawah ini :

choco install deno

Jika berhasil maka dalam directory Chocolatey Package Repository, package Deno akan tersimpan :

C:\ProgramData\chocolatey\lib\deno

3. Check Deno

Check Eksistensi Deno dengan mengeksekusi perintah di bawah ini :

deno -V

Jika berhasil maka akan muncul informasi versi deno yang sedang kita gunakan :

Install Deno For Linux

1. Install Deno via Curl

  1. Buka terminal eksekusi perintah di bawah ini :

    curl -fsSL https://deno.land/x/install/install.sh | sh 
    
  2. Jika berhasil maka proses instalasi akan dilakukan :

    jalankan command deno -V, apabila muncul "commnad not found: deno" maka lanjut ke step berikutnya

  3. Menambahkan path ke bash_profile atau bashrc

    • Eksekusi perintah nano .bashrc atau nano .zshrc tergantung dari shell yang kalian gunakan

    • Salin perintah di bawah ini dan simpan di baris terakhir di .bashrc atau .zshrc

      export DENO_INSTALL="/home/<username>/.deno"
      export PATH="$DENO_INSTALL/bin:$PATH"
      

      Ganti bagian <username> dengan username kalian

    • Save, lalu restart terminal dan jalankan deno -V

2. Install Deno via Package Manager

Via Brew
  1. Install brew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    
  2. Install Deno via Brew

    brew install deno 
    

Install Deno For MacOS

β†₯ back to top

---

Deno 101

Untuk memulai menggunakan Deno ada 3 langkah yang bisa kita gunakan :

REPL Mode Execution

Untuk menggunakan Deno dalam Mode REPL (Read – Eval – Print – Loop), pada cmd.exe ketik :

deno

Eksekusi statement di bawah ini :

1+1

Kemudian eksekusi statement di bawah ini untuk menampilkan pesan Hello World

console.log("Hello World")

Jika berhasil maka akan memproduksi :

Hello World

Jika ingin keluar dari REPL Mode, klik CTRL+Shift+D.

Script Execution

Jika kita ingin mengeksekusi sebuah file javascript yang telah diubah menjadi typescript menggunakan deno, eksekusi perintah di bawah ini :

deno run https://deno.land/std/examples/welcome.ts

Maka anda akan melihat output informasi seperti di bawah ini :

Download https://deno.land/std/examples/welcome.ts
Warning Implicitly using master branch https://deno.land/std/examples/welcome.ts
Compile https://deno.land/std/examples/welcome.ts
Welcome to Deno πŸ¦•

Eval Mode

Mengeksekusi dalam mode eval jarang sekali dilakukan dan hanya digunakan di kasus-kasus tertentu saja. Di versi node.js sebelumnya eval mode merupakan model eksekusi yang rentan untuk dieksploitasi, pada deno kerentanan tersebut sudah di perbaiki.

Untuk mengetahui cara mengeksekusi dalam eval mode, eksekusi contoh kode di bawah ini :

deno eval "console.log(30933 + 404)"

Deno Command

Deno memiliki Options & Sub Commands yang dapat kita gunakan :

1. Deno Options

Saat kita mengeksekusi perintah dengan options di bawah ini :

deno --help

Terdapat struktur yang bisa kita pelajari :

2. Deno Sub Command

Saat kita mengeksekusi perintah dengan sub command di bawah ini :

deno run https://a.com/test/hello.ts

Terdapat struktur yang bisa kita pelajari :

3. Deno Command Structure

Kita dapat melihat gambaran besar lebih jauh dari Deno Options dan Sub-commands dengan gambar di bawah ini :

Run Javascript & Typescript Files

Buatlah dua buah file dengan nama Example.js dan Example.ts dan tulis kode di bawah ini :

import { serve } from "https://deno.land/std@0.50.0/http/server.ts";
for await (const req of serve({ port: 8000 })) {
  req.respond({ body: "Hello World\n" });
}

Kemudian eksekusi perintah di bawah ini :

deno run Example.js

Anda akan mendapatkan error sebagai berikut :

error: Uncaught PermissionDenied: network access to "0.0.0.0:8000", run again with the --allow-net flag

Ini bukti bahwa deno memiliki mekanisme keamanan yang baik dengan menerapkan konsep Access Control yang baik, agar kita dapat menggunakannya tambahkan --allow-net flag setelah sub command :

deno run --allow-net Example.js

Buka browser anda dan kunjungi 127.0.0.1:8000

Untuk mengeksekusi typescript file :

deno run --allow-net Example.ts

β†₯ back to top

Other Examples :

Denovel - A Deno Framework for Web Artisan By Muhammad Fauzan @fauzan121002

Deno Simple Framework Simple Deno Framework for Beginner by Muhamad Nauval Azhar @nauvalazhar

Contributor

Feel free guys to make contribution for the community <3 just pull request.

Sponsor

β†₯ back to top

About

πŸ“š PinterCoding University. Lets Destroy Node.js developer.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •