├── .gitignore ├── README-OLD.md ├── README.md ├── asinkron_io_&_event ├── index.html ├── javascript_&_nodejs.html └── php_&_server_http_apache.html ├── belajar_node.js.epub ├── belajar_node.js.pdf ├── code ├── app.js ├── onclick-button.html ├── resource.json ├── server-file │ ├── server-file.js │ └── www │ │ ├── css │ │ └── main.css │ │ ├── index.html │ │ └── js │ │ └── main.js └── server-http.js ├── cover.jpg ├── cover └── cover.xcf ├── cover_small.jpg ├── database ├── enkripsi.html ├── index.html ├── mongodb.html ├── mongoose.html ├── mysql.html ├── node-sqlite3.html ├── node_mongodb.html ├── node_mysql.html ├── sqlchiper.html └── sqlite.html ├── es6 └── memakai_es6.html ├── expressjs ├── akses_server.html ├── index.html ├── kode.md ├── middleware.html ├── server.html └── server_rest.html ├── gitbook ├── app.js ├── fonts │ └── fontawesome │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ └── fontawesome-webfont.woff ├── images │ ├── apple-touch-icon-precomposed-152.png │ └── favicon.ico ├── plugins │ ├── gitbook-plugin-fontsettings │ │ ├── buttons.js │ │ └── website.css │ ├── gitbook-plugin-highlight │ │ ├── ebook.css │ │ └── website.css │ ├── gitbook-plugin-search │ │ ├── lunr.min.js │ │ ├── search.css │ │ └── search.js │ └── gitbook-plugin-sharing │ │ └── buttons.js └── style.css ├── image_uploader └── index.html ├── images ├── akses-file-di-server.png ├── belajar-asinkron-nodejs.png ├── enable.png ├── geeklist.png ├── get-form.png ├── github-service.png ├── image-build.png ├── image-uploader.png ├── klout.png ├── learnboost.png ├── modul-npm.png ├── mypspace.png ├── nginx-apache-reqs-sec.png ├── node-sqlite3-enkripsi.png ├── node-sqlite3-no-enkripsi.png ├── notif.png ├── npm-flow.gliffy ├── npm-flow.png ├── person-rest-delete.png ├── person-rest-get.png ├── person-rest-post.png ├── person-rest-update.png ├── persons-rest-api.png ├── persons-rest-diagram.png ├── persons.gliffy ├── post-urlencoded-data.png ├── server-response-dev-tool.png ├── shutterstock.png ├── testing-ci.png ├── testing-mocha.png ├── todatauri.gliffy ├── todatauri.png └── yummly.png ├── index.html ├── index.jade ├── nodejs ├── index.html ├── javascript_di_server.html └── nodejs_show.html ├── npm ├── index.html ├── konsep.html └── npm.html ├── pemrosesan_data_form_html ├── index.html ├── multipart.html └── url_encoded.html ├── pengarang └── index.html ├── person_rest_api ├── index.html ├── inisialisasi.html ├── kode.html └── testing.html ├── search_index.json ├── server_file_statis ├── index.html └── kode.md ├── server_http_dasar ├── index.html └── menjalankan_server.html ├── style ├── base.css ├── github.less ├── layout.css ├── main.css └── skeleton.css ├── testing ├── automasi.html ├── index.html ├── mocha.html └── rest_testing.html └── todatauri ├── koneksi_mysql.html ├── konverter_gambar_png_ke_data_uri.html ├── penggunaan.html └── todatauri.html /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | atlassian-ide-plugin.xml 3 | -------------------------------------------------------------------------------- /README-OLD.md: -------------------------------------------------------------------------------- 1 | Belajar Node.js 2 | =============== 3 | Maintained by [Equan Pr][1]. 4 | 5 | [![cc-by-3.0](http://i.creativecommons.org/l/by/3.0/80x15.png)](http://creativecommons.org/licenses/by/3.0/) 6 | 7 | 8 | > Buku ini juga tersedia di GitBook online. Kunjungi link berikut ini untuk format PDF, EPUB atau MOBI 9 | > http://junwatu.gitbooks.io/pengenalan-nodejs/ 10 | 11 | 12 | Daftar Isi: 13 | 14 | + [Pengenalan] (#Pengenalan) 15 | + Asinkron I/O & Event 16 | + Server HTTP Dasar 17 | + Menyediakan File Statis 18 | + Memproses Data Form HTML 19 | + Modul 20 | + Express - Framework Aplikasi Web 21 | + Aplikasi Picture Uploader 22 | 23 | 24 | ##Pengenalan 25 | 26 | Javascript merupakan bahasa pemrograman yang lengkap hanya saja selama ini di pakai sebagai bahasa untuk pengembangan aplikasi web yang berjalan pada sisi client atau browser saja. Tetapi sejak ditemukannya Node.js oleh Ryan Dhal pada tahun 2009, Javascript bisa digunakan sebagai bahasa pemrograman di sisi server sekelas dengan PHP, ASP, C#, Ruby dll dengan kata lain Node.js menyediakan platform untuk membuat aplikasi Javascript dapat dijalankan di sisi server. 27 | 28 | Untuk mengeksekusi Javascript sebagai bahasa server diperlukan engine yang cepat dan mempunyai performansi yang bagus. Engine Javascript dari Google bernama V8 yang dipakai oleh Node.js yang merupakan engine yang sama yang dipakai di browser Google Chrome. 29 | 30 | 31 | ###Javascript Di Server 32 | 33 | 34 | Tak terelakkan bahwa Javascript merupakan bahasa pemrograman yang paling populer. Jika anda sebagai developer pernah mengembangkan aplikasi web maka penggunaan Javascript pasti tidak terhindarkan. 35 | 36 | Sekarang dengan berjalannya Javascript di server lalu apa keuntungan yang anda peroleh dengan mempelajari Node.js, kurang lebih seperti ini : 37 | 38 | + Pengembang hanya memakai satu bahasa untuk mengembangkan aplikasi lengkap client & server sehingga mengurangi 'Learning Curve' untuk mempelajari bahasa server yang lain. 39 | 40 | + Sharing kode antara client dan server atau istilahnya code reuse. 41 | 42 | + Javascript secara native mendukung JSON yang merupakan standar transfer data yang banyak dipakai saat ini sehingga untuk mengkonsumsi data-data dari pihak ketiga pemrosesan di Node.js akan sangat mudah sekali. 43 | 44 | + Database NoSQL seperti MongoDB dan CouchDB mendukung langsung Javascript sehingga interfacing dengan database ini akan jauh lebih mudah. 45 | 46 | + Node.js memakai V8 yang selalu mengikuti perkembangan standar ECMAScript, jadi tidak perlu ada kekhawatiran bahwa browser tidak akan mendukung fitur-fitur di Node.js. 47 | 48 | 49 | ###Node.js In Action 50 | 51 | Supaya anda lebih tertarik dalam belajar Node.js berikut beberapa website terkenal yang sudah memakai Node.js 52 | 53 | 54 | www.myspace.com 55 | 56 | ![myspace](https://raw.github.com/idjs/belajar-nodejs/gh-pages/images/mypspace.png) 57 | 58 | 59 | www.yummly.com 60 | 61 | ![yummly](https://raw.github.com/idjs/belajar-nodejs/gh-pages/images/yummly.png) 62 | 63 | 64 | www.shutterstock.com 65 | 66 | ![shutterstock](https://raw.github.com/idjs/belajar-nodejs/gh-pages/images/shutterstock.png) 67 | 68 | 69 | www.klout.com 70 | 71 | ![klout](https://raw.github.com/idjs/belajar-nodejs/gh-pages/images/klout.png) 72 | 73 | 74 | www.geekli.st 75 | 76 | ![geeklist](https://raw.github.com/idjs/belajar-nodejs/gh-pages/images/geeklist.png) 77 | 78 | 79 | www.learnboost.com 80 | 81 | ![learnboost](https://raw.github.com/idjs/belajar-nodejs/gh-pages/images/learnboost.png) 82 | 83 | 84 | Apakah masih ragu untuk memakai Node.js ?...Kalau masih penasaran apa yang membuat Node.js berbeda dari backend pada umumnya, silahkan dilanjutkan membaca :smile: 85 | 86 | 87 | ##Asinkron I/O & Event 88 | 89 | 90 | Tidak seperti kebanyakan bahasa backend lainnya operasi fungsi di javascript lebih bersifat `asinkron` dan banyak menggunakan `event` demikian juga dengan Node.js. Sebelum penjelasan lebih lanjut mari kita lihat terlebih dahulu tentang metode `sinkron` seperti yang dipakai pada PHP dengan web server Apache. 91 | 92 | 93 | ###PHP & Server HTTP Apache 94 | 95 | Mari kita lihat contoh berikut yaitu operasi fungsi akses ke database MySQL oleh PHP yang dilakukan secara sinkron 96 | 97 | ``` 98 | $hasil = mysql_query("SELECT * FROM TabelAnggota"); 99 | print_r($hasil); 100 | ``` 101 | 102 | pengambilan data oleh `mysql_query()` diatas akan dijalankan dan operasi berikutnya `print_r()` akan diblok atau tidak akan berjalan sebelum akses ke database selesai. Yang perlu menjadi perhatian disini yaitu proses Input Output atau I/O akses ke database oleh `mysql_query()` dapat memakan waktu yang relatif mungkin beberapa detik atau menit tergantung dari waktu latensi dari I/O. Waktu latensi ini tergantung dari banyak hal seperti 103 | 104 | + Query database lambat akibat banyak pengguna yang mengakses 105 | + Kualitas jaringan untuk akses ke database jelek 106 | + Proses baca tulis ke disk komputer database yang membutuhkan waktu 107 | + ... 108 | 109 | Sebelum proses I/O selesai maka selama beberapa detik atau menit tersebut state dari proses `mysql_query()` bisa dibilang idle atau tidak melakukan apa-apa. 110 | 111 | Lalu jika proses I/O di blok bagaimana jika ada request lagi dari user ? apa yang akan dilakukan oleh server untuk menangani request ini ?..penyelesaiannya yaitu dengan memakai pendekatan proses `multithread`. Melalui pendekatan ini tiap koneksi yang terjadi akan ditangani oleh `thread`. Thread disini bisa dikatakan sebagai task yang dijalankan oleh prosesor komputer. 112 | 113 | Sepertinya permasalahan I/O yang terblok terselesaikan dengan pendekatan metode ini tetapi dengan bertambahnya koneksi yang terjadi maka `thread` akan semakin banyak sehingga prosesor akan semakin terbebani, belum lagi untuk switching antar thread menyebabkan konsumsi memory (RAM) komputer yang cukup besar. 114 | 115 | Berikut contoh benchmark antara web server Apache dan Nginx (server HTTP seperti halnya Apache hanya saja Nginx memakai sistem asinkron I/O dan event yang mirip Node.js). Gambar ini diambil dari [goo.gl/pvLL4](http://goo.gl/pvLL4) 116 | 117 | 118 | ![apache-vs-nginx-reqs-sec](https://raw.github.com/idjs/belajar-nodejs/gh-pages/images/nginx-apache-reqs-sec.png) 119 | 120 | 121 | Bisa dilihat bahwa Nginx bisa menangani request yang jauh lebih banyak daripada web server Apache pada jumlah koneksi bersama yang semakin naik. 122 | 123 | 124 | ###Javascript & Node.js 125 | 126 | Kembali ke Javascript!. Untuk mengetahui apa yang dimaksud dengan pemrograman asinkron bisa lebih mudah dengan memakai pendekatan contoh kode. Perhatikan kode Javascript pada Node.js berikut 127 | 128 | 129 | ``` 130 | var fs = require('fs'); 131 | 132 | fs.readFile('./resource.json',function(err, data){ 133 | if(err) throw err; 134 | console.log(JSON.parse(data)); 135 | }); 136 | 137 | console.log('Selanjutnya...'); 138 | 139 | ``` 140 | 141 | fungsi `readFile()` akan membaca membaca isi dari file `resource.json` secara asinkron yang artinya proses eksekusi program tidak akan menunggu pembacaan file `resource.json` sampai selesai tetapi program akan tetap menjalankan kode Javascript selanjutnya yaitu `console.log('Selanjutnya...')`. Sekarng lihat apa yang terjadi jika kode javascript diatas dijalankan 142 | 143 | 144 | ![belajar-asinkron-nodejs](https://raw.github.com/idjs/belajar-nodejs/gh-pages/images/belajar-asinkron-nodejs.png) 145 | 146 | 147 | Jika proses pembacaan file `resource.json` selesai maka fungsi callback pada `readFile()` akan di jalankan dan hasilnya akan ditampilkan pada console. Yah, fungsi callback merupakan konsep yang penting dalam proses I/O yang asinkron karena melalui fungsi callback ini data data yang dikembalikan oleh proses I/O akan di proses. 148 | 149 | Lalu bagaimana platform Node.js mengetahui kalau suatu proses itu telah selesai atau tidak ?...jawabannya adalah [Event Loop](http://en.wikipedia.org/wiki/Event_loop). Event - event yang terjadi karena proses asinkron seperti pada fungsi `fs.readFile()` akan ditangani oleh yang namanya Event Loop ini. 150 | 151 | Campuran teknologi antara event driven dan proses asinkron ini memungkinkan pembuatan aplikasi dengan penggunaan data secara masif dan real-time. Sifat komunikasi Node.js I/O yang ringan dan bisa menangani user secara bersamaan dalam jumlah relatif besar tetapi tetap menjaga state dari koneksi supaya tetap terbuka dan dengan penggunaan memori yang cukup kecil memungkinkan pengembangan aplikasi dengan penggunaan data yang besar dan kolaboratif...Yeah, Node.js FTW! :metal: 152 | 153 | 154 | ##Server HTTP Dasar 155 | 156 | Penggunaan Node.js yang revolusioner yaitu sebagai server. Yup...mungkin kita terbiasa memakai server seperti Apache - PHP, Nginx - PHP, Java - Tomcat - Apache atau IIS - ASP.NET sebagai pemroses data di sisi server, tetapi sekarang semua itu bisa tergantikan dengan memakai JavaScript - Node.js!. Lihat contoh dasar dari server Node.js berikut (kode sumber pada direktori code pada repositori ini) 157 | 158 | [`server-http.js`](https://raw.github.com/idjs/belajar-nodejs/gh-pages/code/server-http.js) 159 | 160 | ``` 161 | var http = require('http'), 162 | PORT = 3400; 163 | 164 | var server = http.createServer(function(req, res){ 165 | var body = "
Haruskah belajar Node.js?

...Yo Mesto!

" 166 | res.writeHead(200, { 167 | 'Content-Length':body.length, 168 | 'Content-Type':'text/html', 169 | 'Pesan-Header':'Pengenalan Node.js' 170 | }); 171 | 172 | res.write(body); 173 | res.end(); 174 | }); 175 | 176 | server.listen(PORT); 177 | 178 | console.log("Port "+PORT+" : Node.js Server..."); 179 | 180 | ``` 181 | 182 | Paket [http](http://nodejs.org/api/http.html#http_http) merupakan paket bawaan dari platform Node.js yang mendukung penggunaan fitur-fitur protokol HTTP. Object `server` merupakan object yang di kembalikan dari fungsi `createServer()`. 183 | 184 | ``` 185 | var server = http.createServer([requestListener]) 186 | 187 | ``` 188 | 189 | Tiap request yang terjadi akan ditangani oleh fungsi callback `requestListener`. Cara kerja callback ini hampir sama dengan ketika kita menekan tombol button html yang mempunyai atribut event `onclick`, jika ditekan maka fungsi yang teregistrasi oleh event `onclick` yaitu `clickHandler(event)` akan dijalankan. 190 | 191 | [`onclick-button.html`](https://raw.github.com/idjs/belajar-nodejs/gh-pages/code/onclick-button.html) 192 | 193 | ``` 194 | 199 | 200 | 201 | 202 | ``` 203 | 204 | Sama halnya dengan callback `requestListener` pada object `server` ini jika ada request maka `requestListener` akan dijalankan 205 | 206 | 207 | ``` 208 | 209 | function(req, res){ 210 | var body = "
Haruskah belajar Node.js?

...Yo Mesto!

" 211 | res.writeHead(200, { 212 | 'Content-Length':body.length, 213 | 'Content-Type':'text/html', 214 | 'Pesan-Header':'Pengenalan Node.js' 215 | }); 216 | 217 | res.write(body); 218 | res.end(); 219 | } 220 | 221 | ``` 222 | 223 | Paket http Node.js memberikan keleluasan bagi developer untuk membangun server tingkat rendah. Bahkan mudah saja kalau harus men-setting nilai field header dari [HTTP](http://en.wikipedia.org/wiki/List_of_HTTP_header_fields). 224 | 225 | Seperti pada contoh diatas agar respon dari request diperlakukan sebagai HTML oleh browser maka nilai field `Content-Type` harus berupa `text/html`. Setting ini bisa dilakukan melalui metode [`writeHead()`](http://nodejs.org/api/http.html#http_response_writehead_statuscode_reasonphrase_headers), `res.setHeader(field, value)` dan beberapa metode lainnya. 226 | 227 | Untuk membaca header bisa dipakai fungsi seperti `res.getHeader(field, value)` dan untuk menghapus field header tertentu dengan memakai fungsi `res.removeHeader(field)`. Perlu diingat bahwa setting header dilakukan sebelum fungsi `res.write()` atau `res.end()` di jalankan karena jika `res.write()` dijalankan tetapi kemudian ada perubahan field header maka perubahan ini akan diabaikan. 228 | 229 | Satu hal lagi yaitu tentang [kode status dari respon HTTP](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes). Kode status ini bisa disetting selain 200 (request http sukses), misalnya bila diperlukan halaman error dengan kode status 404. 230 | 231 | 232 | ###Menjalankan Server Node.js 233 | 234 | Untuk menjalankan server Node.js ketik perintah berikut 235 | 236 | ``` 237 | $ node server-http.js 238 | Port 3400 : Node.js Server... 239 | 240 | ``` 241 | 242 | Buka browser (chrome) dan buka url `http://localhost:3400` kemudian ketik `CTRL+SHIFT+I` untuk membuka Chrome Dev Tool, dengan tool ini bisa dilihat respon header dari HTTP dimana beberapa fieldnya telah diset sebelumnya (lingkaran merah pada screenshot dibawah ini) 243 | 244 | 245 | ![server-response-dev-tool](https://raw.github.com/idjs/belajar-nodejs/gh-pages/images/server-response-dev-tool.png) 246 | 247 | 248 | 249 | ##Menyediakan File Statis 250 | 251 | 252 | Aplikasi web memerlukan file - file statis seperti CSS, font dan gambar atau file - file library JavaScript agar aplikasi web bekerja sebagaimana mestinya. File - file ini sengaja dipisahkan agar terstruktur dan secara *best practices* file - file ini memang harus dipisahkan. Lalu bagaimana caranya Node.js bisa menyediakan file - file ini ?...ok mari kita buat server Node.js untuk menyediakan file statis. 253 | 254 | Agar server Node.js bisa mengirimkan file statis ke klien maka server perlu mengetahui `path` atau tempat dimana file tersebut berada. 255 | 256 | Node.js bisa mengirimkan file tersebut secara streaming melalui fungsi [`fs.createReadStream()`](http://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options). Sebelum dijelaskan lebih lanjut mungkin bisa dilihat atau di coba saja server file Node.js dibawah ini 257 | 258 | [`server-file.js`](https://raw.github.com/idjs/belajar-nodejs/gh-pages/code/server-file/server-file.js) 259 | 260 | ``` 261 | var http = require('http'), 262 | parse = require('url').parse, 263 | join = require('path').join, 264 | fs = require('fs'), 265 | root = join(__dirname, 'www'), 266 | PORT = 3300, 267 | 268 | server = http.createServer(function(req, res){ 269 | var url = parse(req.url), 270 | path = join(root, url.pathname), 271 | stream = fs.createReadStream(path); 272 | 273 | stream.on('data', function(bagian){ 274 | res.write(bagian); 275 | }); 276 | 277 | stream.on('end', function(){ 278 | res.end(); 279 | }); 280 | 281 | stream.on('error', function(){ 282 | res.setHeader('Content-Type','text/html'); 283 | 284 | var url_demo = "http://localhost:"+PORT+"/index.html"; 285 | res.write("coba buka "+url_demo+""); 286 | res.end(); 287 | }) 288 | 289 | }); 290 | 291 | server.listen(PORT); 292 | console.log('Port '+PORT+': Server File '); 293 | 294 | ``` 295 | 296 | Berikut sedikit penjelasan dari kode diatas 297 | 298 | - [`__dirname`](http://nodejs.org/api/globals.html#globals_dirname) merupakan variabel global yang disediakan oleh Node.js yang berisi path direktori dari file yang sedang aktif mengeksekusi `__dirname`. 299 | - `root` merupakan direktori root atau referensi tempat dimana file-file yang akan dikirimkan oleh server Node.js. Pada kode server diatas direktori root di setting pada direktori `www`. 300 | - `path` adalah path file yang bisa didapatkan dengan menggabungkan path direktori root dan `pathname`. `pathname` yang dimaksud di sini misalnya jika URL yang diminta yaitu `http://localhost:3300/index.html` maka `pathname` adalah `/index.html`. Nilai variabel `path` dihasilkan dengan memakai fungsi `join()`. 301 | 302 | ``` 303 | var path = join(root, url.pathname) 304 | ``` 305 | 306 | - `stream` yang di kembalikan oleh fungsi `fs.createReadStream()` merupakan class [`stream.Readable`](http://nodejs.org/api/stream.html#stream_class_stream_readable). Objek `stream` ini mengeluarkan data secara streaming untuk di olah lebih lanjut. Perlu menjadi catatan bahwa `stream.Readable` tidak akan mengeluarkan data jikalau tidak di kehendaki. Nah...cara untuk mendeteksi data streaming ini sudah siap di konsumsi atau belum adalah melalui event. 307 | 308 | Event yang di dukung oleh class `stream.Readable` adalah sebagai berikut 309 | 310 | 311 | - Event: `readable` 312 | - Event: `data` 313 | - Event: `end` 314 | - Event: `error` 315 | - Event: `close` 316 | 317 | 318 | Mungkin anda bertanya kenapa server file statis diatas memakai stream, bukankah menyediakan file secara langsung saja sudah bisa? jawabannya memang bisa, tetapi mungkin tidak akan efisien kalau file yang akan di berikan ke client mempunyai ukuran yang besar. Coba lihat kode berikut 319 | 320 | ``` 321 | var http = require('http'); 322 | var fs = require('fs'); 323 | 324 | var server = http.createServer(function (req, res) { 325 | fs.readFile(__dirname + '/data.txt', function (err, data) { 326 | res.end(data); 327 | }); 328 | }); 329 | server.listen(8000); 330 | 331 | ``` 332 | Jika file `data.txt` terlalu besar maka buffer yang digunakan oleh sistem juga besar dan konsumsi memori juga akan bertambah besar seiring semakin banyak pengguna yang mengakses file ini. 333 | 334 | Jika anda ingin lebih banyak mendalami tentang Node.js Stream silahkan lihat resource berikut (dalam Bahasa Inggris): 335 | 336 | 1. [Node.js API Stream][2] 337 | 2. [Stream Handbook][3] 338 | 339 | 340 | ##Memproses Data Form HTML 341 | 342 | 343 | Aplikasi web memperoleh data dari pengguna umumnya melalui pengisian form HTML. Contohnya seperti ketika registrasi di media sosial atau aktifitas update status di Facebook misalnya pasti akan mengisi text field dan kemudian menekan tombol submit ataupun enter agar data bisa terkirim dan diproses oleh server. 344 | 345 | 346 | Data yang dikirim oleh form biasanya salah satu dari dua tipe mime berikut 347 | 348 | - application/x-www-form-urlencoded 349 | - multipart/form-data 350 | 351 | Node.js sendiri hanya menyediakan parsing data melalui `body` dari `request` sedangkan untuk validasi atau pemrosesan data akan diserahkan kepada komunitas. 352 | 353 | ### URL Encode 354 | 355 | Hanya akan dibahas untuk 2 metode HTTP yaitu `GET` dan `POST` saja. Metode `GET` untuk menampilkan form html dan `POST` untuk menangani data form yang dikirim 356 | 357 | Ok langsung kita lihat kode server sederhana untuk parsing data form melalui objek `request` dengan data form bertipe `application/x-www-form-urlencoded` yang merupakan default dari tag form. 358 | 359 | ``` 360 | var http = require('http'); 361 | var data = []; 362 | var qs = require('querystring'); 363 | 364 | var server = http.createServer(function(req, res){ 365 | if('/' == req.url){ 366 | switch(req.method){ 367 | case 'GET': 368 | tampilkanForm(res); 369 | break; 370 | case 'POST': 371 | prosesData(req, res); 372 | break; 373 | default: 374 | badRequest(res); 375 | } 376 | } else { 377 | notFound(res); 378 | } 379 | }); 380 | 381 | function tampilkanForm(res){ 382 | var html = 'Data Hobiku' 383 | + '

Hobiku

' 384 | + '
' 385 | + '

' 386 | + '

' 387 | + '
'; 388 | 389 | res.setHeader('Content-Type', 'text/html'); 390 | res.setHeader('Content-Length', Buffer.byteLength(html)); 391 | res.end(html); 392 | } 393 | 394 | function prosesData(req, res) { 395 | var body= ''; 396 | req.setEncoding('utf-8'); 397 | req.on('data', function(chunk){ 398 | body += chunk; 399 | }); 400 | 401 | req.on('end', function(){ 402 | var data = qs.parse(body); 403 | res.setHeader('Content-Type', 'text/plain'); 404 | res.end('Hobiku: '+data.hobi); 405 | }); 406 | } 407 | 408 | function badRequest(res){ 409 | res.statusCode = 400; 410 | res.setHeader('Content-Type', 'text/plain'); 411 | res.end('400 - Bad Request'); 412 | } 413 | 414 | function notFound(res) { 415 | res.statusCode = 404; 416 | res.setHeader('Content-Type', 'text/plain'); 417 | res.end('404 - Not Found'); 418 | } 419 | 420 | server.listen(3003); 421 | console.log('server http berjalan pada port 3003'); 422 | 423 | ``` 424 | 425 | Untuk mengetest `GET` dan `POST` bisa dilakukan melalui curl, browser atau melalui gui [Postman](http://www.getpostman.com/). 426 | 427 | ####GET 428 | 429 | ![GET form fields](https://raw.githubusercontent.com/idjs/belajar-nodejs/gh-pages/images/get-form.png) 430 | 431 | ####POST 432 | 433 | ![POST](https://raw.githubusercontent.com/idjs/belajar-nodejs/gh-pages/images/post-urlencoded-data.png) 434 | 435 | 436 | ### Multipart Data 437 | 438 | ##Modul npm 439 | 440 | `nice people matter` 441 | 442 | npm merupakan package manager untuk Node.js dan untuk nama `npm` bukanlah suatu singkatan. Hanya dalam waktu 2 tahun sejak di releasenya Node.js ke publik jumlah modul melesat jauh bahkan hampir menyamai modul java ataupun ruby gems. 443 | 444 | 445 | ![modulecount npm](https://raw.githubusercontent.com/idjs/belajar-nodejs/gh-pages/images/modul-npm.png) 446 | 447 | 448 | Grafik diatas didapat dari http://modulecounts.com. 449 | 450 | Banyaknya push module ke repositori npm dapat diartikan adanya kepercayaan publik terhadap platform ini dan untuk kedepannya Node.js akan menjadi platform yang prospektif untuk berinvestasi. 451 | 452 | ###Konsep 453 | 454 | npm memakai sistem modul [CommonJS](http://www.commonjs.org/specs/) yang cukup mudah dalam penggunaanya. Sistem modul ini akan meng-export objek JavaScript ke variabel `exports` yang bersifat global di modul tersebut. 455 | 456 | Sebagai contoh 457 | 458 | `band.js` 459 | 460 | ``` 461 | 'use strict'; 462 | 463 | function Band(){} 464 | 465 | Band.prototype.info = function(){ 466 | return 'Nama Band: '+this.name; 467 | } 468 | 469 | Band.prototype.add = function(name){ 470 | this.name = name; 471 | } 472 | 473 | module.exports = new Band(); 474 | ``` 475 | 476 | Untuk pemakaiannya seperti di bawah ini 477 | 478 | `app.js` 479 | 480 | ``` 481 | var band = require('./band.js'); 482 | band.add('Dewa 19'); 483 | 484 | console.log(band.info); 485 | 486 | ``` 487 | 488 | ###npmjs.org 489 | 490 | Sejak versi Node.js 0.6.3 command `npm` sudah ter-bundle dengan installer Node.js. Untuk menginstall modul npm yang anda butuhkan ketik misalnya 491 | 492 | ``` 493 | npm install express 494 | 495 | ``` 496 | 497 | perintah diatas akan mendownload paket `express` dari `http://npmjs.org` dan secara otomatis akan membuat directory `node_modules`. 498 | 499 | Untuk memakai modul `express` ini cukup dengan membuat file JavaScript baru di luar direktori `node_modules` dan load modul dengan keyword `require`. 500 | 501 | 502 | ``` 503 | var app = require('express'); 504 | 505 | // kode lainnya 506 | 507 | ``` 508 | 509 | ##Membuat Paket npm 510 | 511 | Berikut alur umum untuk membuat paket npm 512 | 513 | 514 | 515 | ![alur pembuatan npm](https://raw.githubusercontent.com/idjs/belajar-nodejs/gh-pages/images/npm-flow.png) 516 | 517 | 518 | 519 | Untuk lebih jelasnya silahkan kunjungi dokumentasi untuk [developer npm](https://www.npmjs.org/doc/misc/npm-developers.html). 520 | 521 | 522 | 523 | 524 | ##Express - Framework Aplikasi Web 525 | 526 | (TODO:) 527 | 528 | ##Aplikasi Picture Uploader 529 | 530 | (TODO:) 531 | 532 | 533 | [1]: http://junwatu.github.io 534 | [2]: http://nodejs.org/api/stream.html 535 | [3]: https://github.com/substack/stream-handbook 536 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Belajar Node.js 2 | 3 | Maintained by [Equan Pr][1]. 4 | 5 | Buku ini bisa diakses melalui bebrapa cara 6 | 7 | - :octocat: Repositori idjs 8 | 9 | > http://idjs.github.io/belajar-nodejs/ 10 | 11 | - :earth_asia: Gitbook 12 | 13 | > https://app.gitbook.com/@junwatu/s/pengenalan-node-js/ 14 | 15 | - :green_book: Google Play 16 | 17 | > https://play.google.com/store/books/details?id=pdOfDwAAQBAJ 18 | 19 | Creative Commons License
Ebook ini dibawah lisensi Creative Commons Attribution-NonCommercial 4.0 International License 20 | 21 | [1]: http://github.com/junwatu 22 | -------------------------------------------------------------------------------- /belajar_node.js.epub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/belajar_node.js.epub -------------------------------------------------------------------------------- /belajar_node.js.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/belajar_node.js.pdf -------------------------------------------------------------------------------- /code/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Belajar Node.js 3 | */ 4 | 5 | var fs = require('fs'); 6 | 7 | fs.readFile('./resource.json',function(err, data){ 8 | if(err) throw err; 9 | console.log(JSON.parse(data)); 10 | }); 11 | 12 | console.log('Selanjutnya...'); 13 | -------------------------------------------------------------------------------- /code/onclick-button.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /code/resource.json: -------------------------------------------------------------------------------- 1 | { 2 | "ebook":"belajar-nodejs" 3 | } 4 | -------------------------------------------------------------------------------- /code/server-file/server-file.js: -------------------------------------------------------------------------------- 1 | var http = require('http'), 2 | parse = require('url').parse, 3 | join = require('path').join, 4 | fs = require('fs'), 5 | root = join(__dirname, 'www'), 6 | PORT = 3300, 7 | 8 | server = http.createServer(function(req, res){ 9 | var url = parse(req.url), 10 | path = join(root, url.pathname), 11 | stream = fs.createReadStream(path); 12 | 13 | stream.on('data', function(bagian){ 14 | res.write(bagian); 15 | }); 16 | 17 | stream.on('end', function(){ 18 | res.end(); 19 | }); 20 | 21 | stream.on('error', function(){ 22 | res.setHeader('Content-Type','text/html'); 23 | 24 | var url_demo = "http://localhost:"+PORT+"/index.html"; 25 | res.write("coba buka "+url_demo+""); 26 | res.end(); 27 | }) 28 | 29 | }); 30 | 31 | server.listen(PORT); 32 | console.log('Port '+PORT+': Server File '); 33 | -------------------------------------------------------------------------------- /code/server-file/www/css/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | max-width: 768px; 3 | margin: 50px auto; 4 | } 5 | h4 { 6 | font-weight: bold; 7 | color: maroon; 8 | } -------------------------------------------------------------------------------- /code/server-file/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sample 5 | 6 | 7 | 8 |

Hello World!

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /code/server-file/www/js/main.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | console.log(" _ _ _ _ "); 4 | console.log(" | \\ | | | | (_) "); 5 | console.log(" | \\| | ___ __| | ___ _ ___ "); 6 | console.log(" | . ` |/ _ \\ / _` |/ _ \\ | / __|"); 7 | console.log(" | |\\ | (_) | (_| | __/_| \\__ \\"); 8 | console.log(" |_| \\_|\\___/ \\__,_|\\___(_| |___/"); 9 | console.log(" _/ | "); 10 | console.log(" |__/ "); 11 | -------------------------------------------------------------------------------- /code/server-http.js: -------------------------------------------------------------------------------- 1 | var http = require('http'), 2 | PORT = 3400; 3 | 4 | http.createServer(function(req, res){ 5 | var body = "
Haruskah belajar Node.js?

...Yo Kudu! :D

" 6 | res.writeHead(200, { 7 | 'Content-Length':Buffer.byteLength(body), 8 | 'Content-Type':'text/html', 9 | 'Pesan-Header':'Pengenalan Node.js' 10 | }); 11 | 12 | res.write(body); 13 | res.end(); 14 | }).listen(PORT); 15 | 16 | console.log("Port "+PORT+" : Node.js Server..."); -------------------------------------------------------------------------------- /cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/cover.jpg -------------------------------------------------------------------------------- /cover/cover.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/cover/cover.xcf -------------------------------------------------------------------------------- /cover_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/cover_small.jpg -------------------------------------------------------------------------------- /expressjs/kode.md: -------------------------------------------------------------------------------- 1 | # Kode 2 | 3 | 4 | Jika anda ingat server file yang memakai modul http pada bab sebelumnya berikut merupakan versi yang memakai ExpressJS 5 | 6 | > app.js 7 | 8 | 'use strict'; 9 | 10 | var express = require('express'); 11 | var server = express(); 12 | var logger = require('morgan'); 13 | 14 | server.use(logger('dev')); 15 | 16 | server.use(express.static(__dirname+'/publik')); 17 | 18 | server.listen(4000, function(){ 19 | console.log('Server file sudah berjalan bos!'); 20 | }); 21 | 22 | Seperti yang dijelaskan pada bab sebelumnya untuk memakai module Node.js di gunakan keyword `require`. 23 | 24 | Modul `express` akan menangani tiap request dari user dan kemudian akan memberikan response berupa file yang diinginkan. Pada kode diatas file yang akan diberikan ke pengguna disimpan pada folder `publik`. 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /gitbook/plugins/gitbook-plugin-fontsettings/buttons.js: -------------------------------------------------------------------------------- 1 | require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) { 2 | var fontState; 3 | 4 | var THEMES = { 5 | "white": 0, 6 | "sepia": 1, 7 | "night": 2 8 | }; 9 | 10 | var FAMILY = { 11 | "serif": 0, 12 | "sans": 1 13 | }; 14 | 15 | // Save current font settings 16 | function saveFontSettings() { 17 | gitbook.storage.set("fontState", fontState); 18 | update(); 19 | } 20 | 21 | // Increase font size 22 | function enlargeFontSize(e) { 23 | e.preventDefault(); 24 | if (fontState.size >= 4) return; 25 | 26 | fontState.size++; 27 | saveFontSettings(); 28 | }; 29 | 30 | // Decrease font size 31 | function reduceFontSize(e) { 32 | e.preventDefault(); 33 | if (fontState.size <= 0) return; 34 | 35 | fontState.size--; 36 | saveFontSettings(); 37 | }; 38 | 39 | // Change font family 40 | function changeFontFamily(index, e) { 41 | e.preventDefault(); 42 | 43 | fontState.family = index; 44 | saveFontSettings(); 45 | }; 46 | 47 | // Change type of color 48 | function changeColorTheme(index, e) { 49 | e.preventDefault(); 50 | 51 | var $book = $(".book"); 52 | 53 | if (fontState.theme !== 0) 54 | $book.removeClass("color-theme-"+fontState.theme); 55 | 56 | fontState.theme = index; 57 | if (fontState.theme !== 0) 58 | $book.addClass("color-theme-"+fontState.theme); 59 | 60 | saveFontSettings(); 61 | }; 62 | 63 | function update() { 64 | var $book = gitbook.state.$book; 65 | 66 | $(".font-settings .font-family-list li").removeClass("active"); 67 | $(".font-settings .font-family-list li:nth-child("+(fontState.family+1)+")").addClass("active"); 68 | 69 | $book[0].className = $book[0].className.replace(/\bfont-\S+/g, ''); 70 | $book.addClass("font-size-"+fontState.size); 71 | $book.addClass("font-family-"+fontState.family); 72 | 73 | if(fontState.theme !== 0) { 74 | $book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, ''); 75 | $book.addClass("color-theme-"+fontState.theme); 76 | } 77 | }; 78 | 79 | function init(config) { 80 | var $bookBody, $book; 81 | 82 | //Find DOM elements. 83 | $book = gitbook.state.$book; 84 | $bookBody = $book.find(".book-body"); 85 | 86 | // Instantiate font state object 87 | fontState = gitbook.storage.get("fontState", { 88 | size: config.size || 2, 89 | family: FAMILY[config.family || "sans"], 90 | theme: THEMES[config.theme || "white"] 91 | }); 92 | 93 | update(); 94 | }; 95 | 96 | 97 | gitbook.events.bind("start", function(e, config) { 98 | var opts = config.fontsettings; 99 | 100 | // Create buttons in toolbar 101 | gitbook.toolbar.createButton({ 102 | icon: 'fa fa-font', 103 | label: 'Font Settings', 104 | className: 'font-settings', 105 | dropdown: [ 106 | [ 107 | { 108 | text: 'A', 109 | className: 'font-reduce', 110 | onClick: reduceFontSize 111 | }, 112 | { 113 | text: 'A', 114 | className: 'font-enlarge', 115 | onClick: enlargeFontSize 116 | } 117 | ], 118 | [ 119 | { 120 | text: 'Serif', 121 | onClick: _.partial(changeFontFamily, 0) 122 | }, 123 | { 124 | text: 'Sans', 125 | onClick: _.partial(changeFontFamily, 1) 126 | } 127 | ], 128 | [ 129 | { 130 | text: 'White', 131 | onClick: _.partial(changeColorTheme, 0) 132 | }, 133 | { 134 | text: 'Sepia', 135 | onClick: _.partial(changeColorTheme, 1) 136 | }, 137 | { 138 | text: 'Night', 139 | onClick: _.partial(changeColorTheme, 2) 140 | } 141 | ] 142 | ] 143 | }); 144 | 145 | 146 | // Init current settings 147 | init(opts); 148 | }); 149 | }); 150 | 151 | 152 | -------------------------------------------------------------------------------- /gitbook/plugins/gitbook-plugin-fontsettings/website.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Theme 1 3 | */ 4 | .color-theme-1 .dropdown-menu { 5 | background-color: #111111; 6 | border-color: #7e888b; 7 | } 8 | .color-theme-1 .dropdown-menu .dropdown-caret .caret-inner { 9 | border-bottom: 9px solid #111111; 10 | } 11 | .color-theme-1 .dropdown-menu .buttons { 12 | border-color: #7e888b; 13 | } 14 | .color-theme-1 .dropdown-menu .button { 15 | color: #afa790; 16 | } 17 | .color-theme-1 .dropdown-menu .button:hover { 18 | color: #73553c; 19 | } 20 | /* 21 | * Theme 2 22 | */ 23 | .color-theme-2 .dropdown-menu { 24 | background-color: #2d3143; 25 | border-color: #272a3a; 26 | } 27 | .color-theme-2 .dropdown-menu .dropdown-caret .caret-inner { 28 | border-bottom: 9px solid #2d3143; 29 | } 30 | .color-theme-2 .dropdown-menu .buttons { 31 | border-color: #272a3a; 32 | } 33 | .color-theme-2 .dropdown-menu .button { 34 | color: #62677f; 35 | } 36 | .color-theme-2 .dropdown-menu .button:hover { 37 | color: #f4f4f5; 38 | } 39 | .book .book-header .font-settings .font-enlarge { 40 | line-height: 30px; 41 | font-size: 1.4em; 42 | } 43 | .book .book-header .font-settings .font-reduce { 44 | line-height: 30px; 45 | font-size: 1em; 46 | } 47 | .book.color-theme-1 .book-body { 48 | color: #704214; 49 | background: #f3eacb; 50 | } 51 | .book.color-theme-1 .book-body .page-wrapper .page-inner section { 52 | background: #f3eacb; 53 | } 54 | .book.color-theme-2 .book-body { 55 | color: #bdcadb; 56 | background: #1c1f2b; 57 | } 58 | .book.color-theme-2 .book-body .page-wrapper .page-inner section { 59 | background: #1c1f2b; 60 | } 61 | .book.font-size-0 .book-body .page-inner section { 62 | font-size: 1.2rem; 63 | } 64 | .book.font-size-1 .book-body .page-inner section { 65 | font-size: 1.4rem; 66 | } 67 | .book.font-size-2 .book-body .page-inner section { 68 | font-size: 1.6rem; 69 | } 70 | .book.font-size-3 .book-body .page-inner section { 71 | font-size: 2.2rem; 72 | } 73 | .book.font-size-4 .book-body .page-inner section { 74 | font-size: 4rem; 75 | } 76 | .book.font-family-0 { 77 | font-family: Georgia, serif; 78 | } 79 | .book.font-family-1 { 80 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 81 | } 82 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal { 83 | color: #704214; 84 | } 85 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a { 86 | color: inherit; 87 | } 88 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 89 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2, 90 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3, 91 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4, 92 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5, 93 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 94 | color: inherit; 95 | } 96 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 97 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 { 98 | border-color: inherit; 99 | } 100 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 101 | color: inherit; 102 | } 103 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr { 104 | background-color: inherit; 105 | } 106 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote { 107 | border-color: inherit; 108 | } 109 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, 110 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { 111 | background: #fdf6e3; 112 | color: #657b83; 113 | border-color: #f8df9c; 114 | } 115 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight { 116 | background-color: inherit; 117 | } 118 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th, 119 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td { 120 | border-color: #f5d06c; 121 | } 122 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr { 123 | color: inherit; 124 | background-color: #fdf6e3; 125 | border-color: #444444; 126 | } 127 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 128 | background-color: #fbeecb; 129 | } 130 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal { 131 | color: #bdcadb; 132 | } 133 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a { 134 | color: #3eb1d0; 135 | } 136 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 137 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2, 138 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3, 139 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4, 140 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5, 141 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 142 | color: #fffffa; 143 | } 144 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 145 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 { 146 | border-color: #373b4e; 147 | } 148 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 149 | color: #373b4e; 150 | } 151 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr { 152 | background-color: #373b4e; 153 | } 154 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote { 155 | border-color: #373b4e; 156 | } 157 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, 158 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { 159 | color: #9dbed8; 160 | background: #2d3143; 161 | border-color: #2d3143; 162 | } 163 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight { 164 | background-color: #282a39; 165 | } 166 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th, 167 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td { 168 | border-color: #3b3f54; 169 | } 170 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr { 171 | color: #b6c2d2; 172 | background-color: #2d3143; 173 | border-color: #3b3f54; 174 | } 175 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 176 | background-color: #35394b; 177 | } 178 | .book.color-theme-1 .book-header { 179 | color: #afa790; 180 | background: transparent; 181 | } 182 | .book.color-theme-1 .book-header .btn { 183 | color: #afa790; 184 | } 185 | .book.color-theme-1 .book-header .btn:hover { 186 | color: #73553c; 187 | background: none; 188 | } 189 | .book.color-theme-1 .book-header h1 { 190 | color: #704214; 191 | } 192 | .book.color-theme-2 .book-header { 193 | color: #7e888b; 194 | background: transparent; 195 | } 196 | .book.color-theme-2 .book-header .btn { 197 | color: #3b3f54; 198 | } 199 | .book.color-theme-2 .book-header .btn:hover { 200 | color: #fffff5; 201 | background: none; 202 | } 203 | .book.color-theme-2 .book-header h1 { 204 | color: #bdcadb; 205 | } 206 | .book.color-theme-1 .book-body .navigation { 207 | color: #afa790; 208 | } 209 | .book.color-theme-1 .book-body .navigation:hover { 210 | color: #73553c; 211 | } 212 | .book.color-theme-2 .book-body .navigation { 213 | color: #383f52; 214 | } 215 | .book.color-theme-2 .book-body .navigation:hover { 216 | color: #fffff5; 217 | } 218 | /* 219 | * Theme 1 220 | */ 221 | .book.color-theme-1 .book-summary { 222 | color: #afa790; 223 | background: #111111; 224 | border-right: 1px solid rgba(0, 0, 0, 0.07); 225 | } 226 | .book.color-theme-1 .book-summary .book-search { 227 | background: transparent; 228 | } 229 | .book.color-theme-1 .book-summary .book-search input, 230 | .book.color-theme-1 .book-summary .book-search input:focus { 231 | border: 1px solid transparent; 232 | } 233 | .book.color-theme-1 .book-summary ul.summary li.divider { 234 | background: #7e888b; 235 | box-shadow: none; 236 | } 237 | .book.color-theme-1 .book-summary ul.summary li i.fa-check { 238 | color: #33cc33; 239 | } 240 | .book.color-theme-1 .book-summary ul.summary li.done > a { 241 | color: #877f6a; 242 | } 243 | .book.color-theme-1 .book-summary ul.summary li a, 244 | .book.color-theme-1 .book-summary ul.summary li span { 245 | color: #877f6a; 246 | background: transparent; 247 | font-weight: normal; 248 | } 249 | .book.color-theme-1 .book-summary ul.summary li.active > a, 250 | .book.color-theme-1 .book-summary ul.summary li a:hover { 251 | color: #704214; 252 | background: transparent; 253 | font-weight: normal; 254 | } 255 | /* 256 | * Theme 2 257 | */ 258 | .book.color-theme-2 .book-summary { 259 | color: #bcc1d2; 260 | background: #2d3143; 261 | border-right: none; 262 | } 263 | .book.color-theme-2 .book-summary .book-search { 264 | background: transparent; 265 | } 266 | .book.color-theme-2 .book-summary .book-search input, 267 | .book.color-theme-2 .book-summary .book-search input:focus { 268 | border: 1px solid transparent; 269 | } 270 | .book.color-theme-2 .book-summary ul.summary li.divider { 271 | background: #272a3a; 272 | box-shadow: none; 273 | } 274 | .book.color-theme-2 .book-summary ul.summary li i.fa-check { 275 | color: #33cc33; 276 | } 277 | .book.color-theme-2 .book-summary ul.summary li.done > a { 278 | color: #62687f; 279 | } 280 | .book.color-theme-2 .book-summary ul.summary li a, 281 | .book.color-theme-2 .book-summary ul.summary li span { 282 | color: #c1c6d7; 283 | background: transparent; 284 | font-weight: 600; 285 | } 286 | .book.color-theme-2 .book-summary ul.summary li.active > a, 287 | .book.color-theme-2 .book-summary ul.summary li a:hover { 288 | color: #f4f4f5; 289 | background: #252737; 290 | font-weight: 600; 291 | } 292 | -------------------------------------------------------------------------------- /gitbook/plugins/gitbook-plugin-highlight/ebook.css: -------------------------------------------------------------------------------- 1 | pre, 2 | code { 3 | /* http://jmblog.github.io/color-themes-for-highlightjs */ 4 | /* Tomorrow Comment */ 5 | /* Tomorrow Red */ 6 | /* Tomorrow Orange */ 7 | /* Tomorrow Yellow */ 8 | /* Tomorrow Green */ 9 | /* Tomorrow Aqua */ 10 | /* Tomorrow Blue */ 11 | /* Tomorrow Purple */ 12 | } 13 | pre .hljs-comment, 14 | code .hljs-comment, 15 | pre .hljs-title, 16 | code .hljs-title { 17 | color: #8e908c; 18 | } 19 | pre .hljs-variable, 20 | code .hljs-variable, 21 | pre .hljs-attribute, 22 | code .hljs-attribute, 23 | pre .hljs-tag, 24 | code .hljs-tag, 25 | pre .hljs-regexp, 26 | code .hljs-regexp, 27 | pre .ruby .hljs-constant, 28 | code .ruby .hljs-constant, 29 | pre .xml .hljs-tag .hljs-title, 30 | code .xml .hljs-tag .hljs-title, 31 | pre .xml .hljs-pi, 32 | code .xml .hljs-pi, 33 | pre .xml .hljs-doctype, 34 | code .xml .hljs-doctype, 35 | pre .html .hljs-doctype, 36 | code .html .hljs-doctype, 37 | pre .css .hljs-id, 38 | code .css .hljs-id, 39 | pre .css .hljs-class, 40 | code .css .hljs-class, 41 | pre .css .hljs-pseudo, 42 | code .css .hljs-pseudo { 43 | color: #c82829; 44 | } 45 | pre .hljs-number, 46 | code .hljs-number, 47 | pre .hljs-preprocessor, 48 | code .hljs-preprocessor, 49 | pre .hljs-pragma, 50 | code .hljs-pragma, 51 | pre .hljs-built_in, 52 | code .hljs-built_in, 53 | pre .hljs-literal, 54 | code .hljs-literal, 55 | pre .hljs-params, 56 | code .hljs-params, 57 | pre .hljs-constant, 58 | code .hljs-constant { 59 | color: #f5871f; 60 | } 61 | pre .ruby .hljs-class .hljs-title, 62 | code .ruby .hljs-class .hljs-title, 63 | pre .css .hljs-rules .hljs-attribute, 64 | code .css .hljs-rules .hljs-attribute { 65 | color: #eab700; 66 | } 67 | pre .hljs-string, 68 | code .hljs-string, 69 | pre .hljs-value, 70 | code .hljs-value, 71 | pre .hljs-inheritance, 72 | code .hljs-inheritance, 73 | pre .hljs-header, 74 | code .hljs-header, 75 | pre .ruby .hljs-symbol, 76 | code .ruby .hljs-symbol, 77 | pre .xml .hljs-cdata, 78 | code .xml .hljs-cdata { 79 | color: #718c00; 80 | } 81 | pre .css .hljs-hexcolor, 82 | code .css .hljs-hexcolor { 83 | color: #3e999f; 84 | } 85 | pre .hljs-function, 86 | code .hljs-function, 87 | pre .python .hljs-decorator, 88 | code .python .hljs-decorator, 89 | pre .python .hljs-title, 90 | code .python .hljs-title, 91 | pre .ruby .hljs-function .hljs-title, 92 | code .ruby .hljs-function .hljs-title, 93 | pre .ruby .hljs-title .hljs-keyword, 94 | code .ruby .hljs-title .hljs-keyword, 95 | pre .perl .hljs-sub, 96 | code .perl .hljs-sub, 97 | pre .javascript .hljs-title, 98 | code .javascript .hljs-title, 99 | pre .coffeescript .hljs-title, 100 | code .coffeescript .hljs-title { 101 | color: #4271ae; 102 | } 103 | pre .hljs-keyword, 104 | code .hljs-keyword, 105 | pre .javascript .hljs-function, 106 | code .javascript .hljs-function { 107 | color: #8959a8; 108 | } 109 | pre .hljs, 110 | code .hljs { 111 | display: block; 112 | background: white; 113 | color: #4d4d4c; 114 | padding: 0.5em; 115 | } 116 | pre .coffeescript .javascript, 117 | code .coffeescript .javascript, 118 | pre .javascript .xml, 119 | code .javascript .xml, 120 | pre .tex .hljs-formula, 121 | code .tex .hljs-formula, 122 | pre .xml .javascript, 123 | code .xml .javascript, 124 | pre .xml .vbscript, 125 | code .xml .vbscript, 126 | pre .xml .css, 127 | code .xml .css, 128 | pre .xml .hljs-cdata, 129 | code .xml .hljs-cdata { 130 | opacity: 0.5; 131 | } 132 | -------------------------------------------------------------------------------- /gitbook/plugins/gitbook-plugin-search/lunr.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12 3 | * Copyright (C) 2015 Oliver Nightingale 4 | * MIT Licensed 5 | * @license 6 | */ 7 | !function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.5.12",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(t){return arguments.length&&null!=t&&void 0!=t?Array.isArray(t)?t.map(function(t){return t.toLowerCase()}):t.toString().trim().toLowerCase().split(/[\s\-]+/):[]},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,o=0;n>o;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(en.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]h[o]&&o++:(n.add(a[i]),i++,o++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,o=[],r=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n', { 41 | 'class': 'book-search', 42 | 'role': 'search' 43 | }); 44 | 45 | $searchInput = $('', { 46 | 'type': 'text', 47 | 'class': 'form-control', 48 | 'val': value, 49 | 'placeholder': 'Type to search' 50 | }); 51 | 52 | $searchInput.appendTo($searchForm); 53 | $searchForm.prependTo(gitbook.state.$book.find('.book-summary')); 54 | } 55 | 56 | // Return true if search is open 57 | function isSearchOpen() { 58 | return gitbook.state.$book.hasClass("with-search"); 59 | } 60 | 61 | // Toggle the search 62 | function toggleSearch(_state) { 63 | if (isSearchOpen() === _state) return; 64 | 65 | gitbook.state.$book.toggleClass("with-search", _state); 66 | 67 | // If search bar is open: focus input 68 | if (isSearchOpen()) { 69 | gitbook.sidebar.toggle(true); 70 | $searchInput.focus(); 71 | } else { 72 | $searchInput.blur(); 73 | $searchInput.val(""); 74 | gitbook.sidebar.filter(null); 75 | } 76 | } 77 | 78 | // Recover current search when page changed 79 | function recoverSearch() { 80 | var keyword = gitbook.storage.get("keyword", ""); 81 | 82 | createForm(keyword); 83 | 84 | if (keyword.length > 0) { 85 | if(!isSearchOpen()) { 86 | toggleSearch(); 87 | } 88 | gitbook.sidebar.filter(_.pluck(search(keyword), "path")); 89 | } 90 | }; 91 | 92 | 93 | gitbook.events.bind("start", function(config) { 94 | // Pre-fetch search index and create the form 95 | fetchIndex(); 96 | createForm(); 97 | 98 | // Type in search bar 99 | $(document).on("keyup", ".book-search input", function(e) { 100 | var key = (e.keyCode ? e.keyCode : e.which); 101 | var q = $(this).val(); 102 | 103 | if (key == 27) { 104 | e.preventDefault(); 105 | toggleSearch(false); 106 | return; 107 | } 108 | if (q.length == 0) { 109 | gitbook.sidebar.filter(null); 110 | gitbook.storage.remove("keyword"); 111 | } else { 112 | var results = search(q); 113 | gitbook.sidebar.filter( 114 | _.pluck(results, "path") 115 | ); 116 | gitbook.storage.set("keyword", q); 117 | } 118 | }); 119 | 120 | // Create the toggle search button 121 | gitbook.toolbar.createButton({ 122 | icon: 'fa fa-search', 123 | label: 'Search', 124 | position: 'left', 125 | onClick: toggleSearch 126 | }); 127 | 128 | // Bind keyboard to toggle search 129 | gitbook.keyboard.bind(['f'], toggleSearch) 130 | }); 131 | 132 | gitbook.events.bind("page.change", recoverSearch); 133 | }); 134 | 135 | 136 | -------------------------------------------------------------------------------- /gitbook/plugins/gitbook-plugin-sharing/buttons.js: -------------------------------------------------------------------------------- 1 | require(["gitbook", "lodash"], function(gitbook, _) { 2 | var SITES = { 3 | 'facebook': { 4 | 'label': 'Facebook', 5 | 'icon': 'fa fa-facebook', 6 | 'onClick': function(e) { 7 | e.preventDefault(); 8 | window.open("http://www.facebook.com/sharer/sharer.php?s=100&p[url]="+encodeURIComponent(location.href)); 9 | } 10 | }, 11 | 'twitter': { 12 | 'label': 'Twitter', 13 | 'icon': 'fa fa-twitter', 14 | 'onClick': function(e) { 15 | e.preventDefault(); 16 | window.open("http://twitter.com/home?status="+encodeURIComponent(document.title+" "+location.href)); 17 | } 18 | }, 19 | 'google': { 20 | 'label': 'Google+', 21 | 'icon': 'fa fa-google-plus', 22 | 'onClick': function(e) { 23 | e.preventDefault(); 24 | window.open("https://plus.google.com/share?url="+encodeURIComponent(location.href)); 25 | } 26 | }, 27 | 'weibo': { 28 | 'label': 'Weibo', 29 | 'icon': 'fa fa-weibo', 30 | 'onClick': function(e) { 31 | e.preventDefault(); 32 | window.open("http://service.weibo.com/share/share.php?content=utf-8&url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title)); 33 | } 34 | }, 35 | 'instapaper': { 36 | 'label': 'Instapaper', 37 | 'icon': 'fa fa-instapaper', 38 | 'onClick': function(e) { 39 | e.preventDefault(); 40 | window.open("http://www.instapaper.com/text?u="+encodeURIComponent(location.href)); 41 | } 42 | }, 43 | 'vk': { 44 | 'label': 'VK', 45 | 'icon': 'fa fa-vk', 46 | 'onClick': function(e) { 47 | e.preventDefault(); 48 | window.open("http://vkontakte.ru/share.php?url="+encodeURIComponent(location.href)); 49 | } 50 | } 51 | }; 52 | 53 | 54 | 55 | gitbook.events.bind("start", function(e, config) { 56 | var opts = config.sharing; 57 | 58 | // Create dropdown menu 59 | var menu = _.chain(opts.all) 60 | .map(function(id) { 61 | var site = SITES[id]; 62 | 63 | return { 64 | text: site.label, 65 | onClick: site.onClick 66 | }; 67 | }) 68 | .compact() 69 | .value(); 70 | 71 | // Create main button with dropdown 72 | if (menu.length > 0) { 73 | gitbook.toolbar.createButton({ 74 | icon: 'fa fa-share-alt', 75 | label: 'Share', 76 | position: 'right', 77 | dropdown: [menu] 78 | }); 79 | } 80 | 81 | // Direct actions to share 82 | _.each(SITES, function(site, sideId) { 83 | if (!opts[sideId]) return; 84 | 85 | gitbook.toolbar.createButton({ 86 | icon: site.icon, 87 | label: site.text, 88 | position: 'right', 89 | onClick: site.onClick 90 | }); 91 | }); 92 | }); 93 | }); 94 | -------------------------------------------------------------------------------- /images/akses-file-di-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/akses-file-di-server.png -------------------------------------------------------------------------------- /images/belajar-asinkron-nodejs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/belajar-asinkron-nodejs.png -------------------------------------------------------------------------------- /images/enable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/enable.png -------------------------------------------------------------------------------- /images/geeklist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/geeklist.png -------------------------------------------------------------------------------- /images/get-form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/get-form.png -------------------------------------------------------------------------------- /images/github-service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/github-service.png -------------------------------------------------------------------------------- /images/image-build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/image-build.png -------------------------------------------------------------------------------- /images/image-uploader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/image-uploader.png -------------------------------------------------------------------------------- /images/klout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/klout.png -------------------------------------------------------------------------------- /images/learnboost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/learnboost.png -------------------------------------------------------------------------------- /images/modul-npm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/modul-npm.png -------------------------------------------------------------------------------- /images/mypspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/mypspace.png -------------------------------------------------------------------------------- /images/nginx-apache-reqs-sec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/nginx-apache-reqs-sec.png -------------------------------------------------------------------------------- /images/node-sqlite3-enkripsi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/node-sqlite3-enkripsi.png -------------------------------------------------------------------------------- /images/node-sqlite3-no-enkripsi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/node-sqlite3-no-enkripsi.png -------------------------------------------------------------------------------- /images/notif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/notif.png -------------------------------------------------------------------------------- /images/npm-flow.gliffy: -------------------------------------------------------------------------------- 1 | {"contentType":"application/gliffy+json","version":"1.1","metadata":{"title":"untitled","revision":0,"exportBorder":false},"embeddedResources":{"index":0,"resources":[]},"stage":{"objects":[{"x":436,"y":672,"rotation":0,"id":54,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":54,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#418104","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[4,10.5],[-124.66666666666674,10.5],[-124.66666666666674,-287],[-46.00000000000006,-287]],"lockSegments":{"1":true}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":7,"px":0,"py":0.5}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":26,"px":0,"py":0.5}}},"linkMap":[]},{"x":501,"y":732,"rotation":0,"id":53,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":53,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#418104","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[-1,6.75],[-1,24.708333333333258],[-1,24.708333333333258],[-1,42.66666666666663]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":7,"px":0.5,"py":1}}},"linkMap":[]},{"x":502,"y":562,"rotation":0,"id":52,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":52,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#418104","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[-2,18],[-2,33.41666666666663],[-2,48.83333333333337],[-2,64.25]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":19,"px":0.5,"py":1}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":7,"px":0.5,"py":0}}},"linkMap":[]},{"x":498,"y":498,"rotation":0,"id":51,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":51,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#418104","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[2,2],[2,15.333333333333371],[2,28.66666666666663],[2,42]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":16,"px":0.5,"py":1}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":19,"px":0.5,"py":0}}},"linkMap":[]},{"x":498,"y":309,"rotation":0,"id":49,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":49,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#418104","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[1.631578947368439,1],[1.631578947368439,14.33403880828638],[1.631578947368439,27.668077616572702],[1.631578947368439,41.00211642485908]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":24,"px":0.5,"py":1}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":26,"px":0.5,"py":0}}},"linkMap":[]},{"x":504,"y":402,"rotation":0,"id":47,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":47,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#418104","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[-3.9569377990430894,18],[-3.9569377990430894,31.333341059802535],[-3.9569377990430894,44.66668211960513],[-3.9569377990430894,58.00002317940766]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":26,"px":0.5,"py":1}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":16,"px":0.5,"py":0}}},"linkMap":[]},{"x":502,"y":132,"rotation":0,"id":42,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":42,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#418104","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[-2.595693779904309,18],[-2.595693779904309,29.66691263022892],[-2.595693779904309,41.33382526045787],[-2.595693779904309,53.00073789068679]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":0,"px":0.5,"py":1}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":24,"px":0.5,"py":0}}},"linkMap":[]},{"x":350,"y":655,"rotation":0,"id":38,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":150,"height":15,"lockAspectRatio":false,"lockShape":false,"order":24,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

T

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":450,"y":733.75,"rotation":0,"id":37,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":150,"height":15,"lockAspectRatio":false,"lockShape":false,"order":23,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

Y

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":369.63157894736844,"y":185,"rotation":0,"id":24,"uid":"com.gliffy.shape.flowchart.flowchart_v1.default.process","width":260,"height":125,"lockAspectRatio":false,"lockShape":false,"order":0,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#418104","fillColor":"#6BAF21","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[],"linkMap":[]},{"x":390,"y":460,"rotation":0,"id":16,"uid":"com.gliffy.shape.flowchart.flowchart_v1.default.process","width":220,"height":40,"lockAspectRatio":false,"lockShape":false,"order":11,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#418104","fillColor":"#6BAF21","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.31578947368421,"y":0,"rotation":0,"id":18,"uid":null,"width":215.3684210526316,"height":13,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

npm publish . -g

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":380,"y":780,"rotation":0,"id":9,"uid":"com.gliffy.shape.flowchart.flowchart_v1.default.process","width":240,"height":50,"lockAspectRatio":false,"lockShape":false,"order":7,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#418104","fillColor":"#6BAF21","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2,"y":0,"rotation":0,"id":21,"uid":null,"width":236,"height":13,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

npm publish

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":440,"y":626.25,"rotation":0,"id":7,"uid":"com.gliffy.shape.flowchart.flowchart_v1.default.decision","width":120,"height":112.5,"lockAspectRatio":false,"lockShape":false,"order":5,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.diamond.basic_v1","strokeWidth":2,"strokeColor":"#D27023","fillColor":"#E88C3D","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.4,"y":0,"rotation":0,"id":36,"uid":null,"width":115.19999999999999,"height":30,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

Kode Bekerja\n

?

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":390,"y":200,"rotation":0,"id":3,"uid":"com.gliffy.shape.flowchart.flowchart_v1.default.process","width":220,"height":40,"lockAspectRatio":false,"lockShape":false,"order":3,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#418104","fillColor":"#6BAF21","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2,"y":0,"rotation":0,"id":14,"uid":null,"width":216,"height":15,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

Buat direktori untuk paket

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":414.4043062200957,"y":100,"rotation":0,"id":0,"uid":"com.gliffy.shape.flowchart.flowchart_v1.default.process","width":170,"height":50,"lockAspectRatio":false,"lockShape":false,"order":1,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#418104","fillColor":"#6BAF21","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":1.5454545454545454,"y":0,"rotation":0,"id":2,"uid":null,"width":166.90909090909093,"height":13,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

npm adduser

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":440,"y":540,"rotation":0,"id":19,"uid":"com.gliffy.shape.flowchart.flowchart_v1.default.process","width":120,"height":40,"lockAspectRatio":false,"lockShape":false,"order":13,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#418104","fillColor":"#6BAF21","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":1.2631578947368418,"y":0,"rotation":0,"id":20,"uid":null,"width":117.47368421052632,"height":13,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

npm link

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":390,"y":257.5,"rotation":0,"id":22,"uid":"com.gliffy.shape.flowchart.flowchart_v1.default.process","width":220,"height":40,"lockAspectRatio":false,"lockShape":false,"order":15,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#418104","fillColor":"#6BAF21","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.31578947368421,"y":0,"rotation":0,"id":23,"uid":null,"width":215.3684210526316,"height":13,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

npm init

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":389.99999999999994,"y":350,"rotation":0,"id":26,"uid":"com.gliffy.shape.flowchart.flowchart_v1.default.process","width":220.08612440191393,"height":70,"lockAspectRatio":false,"lockShape":false,"order":17,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#418104","fillColor":"#6BAF21","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.5823438596491233,"y":0,"rotation":0,"id":27,"uid":null,"width":214.9214366826157,"height":45,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

Edit kode, Testing dll\n

(Buat paket npm yang hebat! :D )\n

\n

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]}],"background":"#FFFFFF","width":630,"height":830,"maxWidth":5000,"maxHeight":5000,"nodeIndex":55,"autoFit":true,"exportBorder":false,"gridOn":true,"snapToGrid":true,"drawingGuidesOn":true,"pageBreaksOn":false,"printGridOn":false,"printPaper":"LETTER","printShrinkToFit":false,"printPortrait":true,"shapeStyles":{"com.gliffy.shape.flowchart.flowchart_v1.default":{"fill":"#FFFFFF","stroke":"#333333","strokeWidth":2,"gradient":true}},"lineStyles":{"global":{"stroke":"#000000","strokeWidth":2,"endArrow":2,"orthoMode":1}},"textStyles":{},"themeData":{"uid":"com.gliffy.theme.spring_green","name":"Spring Green","shape":{"primary":{"strokeWidth":2,"strokeColor":"#418104","fillColor":"#6BAF21","gradient":false,"dropShadow":false,"opacity":1,"text":{"color":"#FFFFFF","bold":null,"italic":null,"underline":null}},"secondary":{"strokeWidth":2,"strokeColor":"#3971B4","fillColor":"#589AD7","gradient":false,"dropShadow":false,"opacity":1,"text":{"color":"#FFFFFF","bold":null,"italic":null,"underline":null}},"tertiary":{"strokeWidth":2,"strokeColor":"#624025","fillColor":"#91643C","gradient":false,"dropShadow":false,"opacity":1,"text":{"color":"#FFFFFF","bold":null,"italic":null,"underline":null}},"highlight":{"strokeWidth":2,"strokeColor":"#D27023","fillColor":"#E88C3D","gradient":false,"dropShadow":false,"opacity":1,"text":{"color":"#FFFFFF","bold":null,"italic":null,"underline":null}}},"line":{"strokeWidth":2,"strokeColor":"#418104","fillColor":"none","arrowType":2,"interpolationType":"linear","cornerRadius":10,"text":{"color":"#2F3A1C","bold":null,"italic":null,"underline":null}},"text":{"color":"#2F3A1C","bold":null,"italic":null,"underline":null},"stage":{"color":"#FFFFFF"}}}} -------------------------------------------------------------------------------- /images/npm-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/npm-flow.png -------------------------------------------------------------------------------- /images/person-rest-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/person-rest-delete.png -------------------------------------------------------------------------------- /images/person-rest-get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/person-rest-get.png -------------------------------------------------------------------------------- /images/person-rest-post.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/person-rest-post.png -------------------------------------------------------------------------------- /images/person-rest-update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/person-rest-update.png -------------------------------------------------------------------------------- /images/persons-rest-api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/persons-rest-api.png -------------------------------------------------------------------------------- /images/persons-rest-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/persons-rest-diagram.png -------------------------------------------------------------------------------- /images/persons.gliffy: -------------------------------------------------------------------------------- 1 | {"contentType":"application/gliffy+json","version":"1.1","metadata":{"title":"untitled","revision":0,"exportBorder":false},"embeddedResources":{"index":0,"resources":[]},"stage":{"objects":[{"x":80,"y":360,"rotation":0,"id":30,"uid":"com.gliffy.shape.ui.ui_v2.forms_components.window","width":270,"height":100,"lockAspectRatio":false,"lockShape":false,"order":0,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.window.ui_v2","strokeWidth":2,"strokeColor":"#000000","fillColor":"#FFFFFF","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":1.9148936170212765,"y":0,"rotation":0,"id":32,"uid":null,"width":266.17021276595744,"height":16,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"top","overflow":"none","vposition":"none","hposition":"none","html":"

Antar Muka Web atau CLI

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":170,"y":290,"rotation":270,"id":28,"uid":"com.gliffy.shape.basic.basic_v1.default.double_arrow","width":80,"height":30,"lockAspectRatio":false,"lockShape":false,"order":16,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.double_arrow.basic_v1","strokeWidth":2,"strokeColor":"#e2e2e2","fillColor":"#666666","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[],"linkMap":[]},{"x":379,"y":105,"rotation":0,"id":11,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":7,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":2,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[-16,13],[93,-11]],"lockSegments":{}}},"children":[{"x":0,"y":0,"rotation":0,"id":13,"uid":null,"width":24,"height":14,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"both","vposition":"none","hposition":"none","html":"

GET

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":33.99999999999997,"y":46,"rotation":0,"id":6,"uid":"com.gliffy.shape.network.network_v3.home.cloud","width":340,"height":213,"lockAspectRatio":false,"lockShape":false,"order":5,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.cloud.network_v3","strokeWidth":2,"strokeColor":"#000000","fillColor":"#ffffff","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.111801242236025,"y":0,"rotation":0,"id":20,"uid":null,"width":335.7763975155279,"height":41,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

Internet\n

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":490,"y":80,"rotation":0,"id":1,"uid":"com.gliffy.shape.basic.basic_v1.default.square","width":170,"height":170,"lockAspectRatio":true,"lockShape":false,"order":2,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#333333","fillColor":"#FFFFFF","gradient":false,"dropShadow":true,"state":0,"shadowX":4,"shadowY":4,"opacity":1}},"children":[{"x":2,"y":0,"rotation":0,"id":5,"uid":null,"width":166,"height":28,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

Person REST \n

Server

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":382,"y":140,"rotation":0,"id":14,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":9,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[-1.1314218345384006,-8.526512829121202e-14],[94.04786015641184,-5.684341886080802e-14]],"lockSegments":{}}},"children":[{"x":0,"y":0,"rotation":0,"id":15,"uid":null,"width":47,"height":14,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"both","vposition":"none","hposition":"none","html":"

DELETE

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":380,"y":178,"rotation":0,"id":16,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":11,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[-2,-7],[94.04786015641184,-5.684341886080802e-14]],"lockSegments":{}}},"children":[{"x":0,"y":0,"rotation":0,"id":17,"uid":null,"width":24,"height":14,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"both","vposition":"none","hposition":"none","html":"

PUT

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":381,"y":225,"rotation":0,"id":18,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":13,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[-16,-32],[93,1]],"lockSegments":{}}},"children":[{"x":0,"y":0,"rotation":0,"id":19,"uid":null,"width":32,"height":14,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"both","vposition":"none","hposition":"none","html":"

POST

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":765,"y":110,"rotation":0,"id":23,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":150,"height":16,"lockAspectRatio":false,"lockShape":false,"order":15,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

MongoDB

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":680,"y":160,"rotation":0,"id":3,"uid":"com.gliffy.shape.basic.basic_v1.default.double_arrow","width":100,"height":25,"lockAspectRatio":false,"lockShape":false,"order":4,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.double_arrow.basic_v1","strokeWidth":2,"strokeColor":"#333333","fillColor":"#FFFFFF","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[],"linkMap":[]},{"x":800,"y":132.5,"rotation":0,"id":0,"uid":"com.gliffy.shape.sitemap.sitemap_v1.default.database","width":80,"height":80,"lockAspectRatio":true,"lockShape":false,"order":1,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.database.sitemap_v1","strokeWidth":2,"strokeColor":"#666666","fillColor":"#6699CC","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[],"linkMap":[]}],"background":"#FFFFFF","width":913,"height":460,"maxWidth":5000,"maxHeight":5000,"nodeIndex":34,"autoFit":true,"exportBorder":false,"gridOn":true,"snapToGrid":true,"drawingGuidesOn":true,"pageBreaksOn":false,"printGridOn":false,"printPaper":"LETTER","printShrinkToFit":false,"printPortrait":true,"shapeStyles":{"com.gliffy.shape.sitemap.sitemap_v1.default":{"fill":"#6699CC","stroke":"#666666","strokeWidth":2},"com.gliffy.shape.basic.basic_v1.default":{"fill":"#666666","stroke":"#e2e2e2","strokeWidth":2,"shadow":true},"com.gliffy.shape.network.network_v3.home":{"fill":"#ffffff"}},"lineStyles":{"global":{"startArrow":0,"endArrow":2}},"textStyles":{},"themeData":null}} -------------------------------------------------------------------------------- /images/post-urlencoded-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/post-urlencoded-data.png -------------------------------------------------------------------------------- /images/server-response-dev-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/server-response-dev-tool.png -------------------------------------------------------------------------------- /images/shutterstock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/shutterstock.png -------------------------------------------------------------------------------- /images/testing-ci.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/testing-ci.png -------------------------------------------------------------------------------- /images/testing-mocha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/testing-mocha.png -------------------------------------------------------------------------------- /images/todatauri.gliffy: -------------------------------------------------------------------------------- 1 | {"contentType":"application/gliffy+json","version":"1.1","metadata":{"title":"untitled","revision":0,"exportBorder":false},"embeddedResources":{"index":0,"resources":[]},"stage":{"objects":[{"x":710,"y":362,"rotation":0,"id":34,"uid":"com.gliffy.shape.basic.basic_v1.default.image","width":170,"height":115,"lockAspectRatio":true,"lockShape":false,"order":10,"graphic":{"type":"Image","Image":{"url":"data:image/png;base64,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","strokeWidth":2,"strokeColor":"#000000","dropShadow":false,"shadowX":0,"shadowY":0}},"children":null,"linkMap":[]},{"x":520,"y":388,"rotation":0,"id":32,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":150,"height":14,"lockAspectRatio":false,"lockShape":false,"order":9,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

Simpan

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":300,"y":260,"rotation":270,"id":30,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":150,"height":14,"lockAspectRatio":false,"lockShape":false,"order":8,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

Download

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":380,"y":150,"rotation":0,"id":26,"uid":"com.gliffy.shape.sitemap.sitemap_v1.default.page","width":35,"height":40,"lockAspectRatio":false,"lockShape":false,"order":6,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.page.sitemap_v1","strokeWidth":2,"strokeColor":"#999999","fillColor":"#6699CC","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.333333333333334,"y":0,"rotation":0,"id":29,"uid":null,"width":30.333333333333336,"height":14,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

.png

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":319.99999999999744,"y":250,"rotation":270,"id":24,"uid":"com.gliffy.shape.basic.basic_v1.default.left_arrow","width":150,"height":40,"lockAspectRatio":false,"lockShape":false,"order":0,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.left_arrow.basic_v1","strokeWidth":2,"strokeColor":"#ffffff","fillColor":"#9fc5e8","gradient":false,"dropShadow":true,"state":0,"shadowX":4,"shadowY":4,"opacity":1}},"children":[],"linkMap":[]},{"x":522,"y":399.5,"rotation":0,"id":21,"uid":"com.gliffy.shape.basic.basic_v1.default.double_arrow","width":160,"height":40,"lockAspectRatio":false,"lockShape":false,"order":5,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.double_arrow.basic_v1","strokeWidth":2,"strokeColor":"#ffffff","fillColor":"#9fc5e8","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[],"linkMap":[]},{"x":275,"y":64.99999999999977,"rotation":0,"id":17,"uid":"com.gliffy.shape.network.network_v3.home.cloud","width":230.00000000000003,"height":140,"lockAspectRatio":false,"lockShape":false,"order":3,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.cloud.network_v3","strokeWidth":2,"strokeColor":"#000000","fillColor":"#cfe2f3","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.5555555555555554,"y":0,"rotation":0,"id":23,"uid":null,"width":224.88888888888894,"height":14,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

INTERNET

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":705,"y":319,"rotation":0,"id":14,"uid":"com.gliffy.shape.sitemap.sitemap_v1.default.database","width":90,"height":90,"lockAspectRatio":true,"lockShape":false,"order":11,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.database.sitemap_v1","strokeWidth":2,"strokeColor":"#999999","fillColor":"#6699CC","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":null,"linkMap":[]},{"x":263,"y":385,"rotation":0,"id":11,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":230,"height":14,"lockAspectRatio":false,"lockShape":false,"order":2,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

$ node ./tdi.js http://uncal.no/lawang.png

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":260,"y":362,"rotation":0,"id":8,"uid":"com.gliffy.shape.ui.ui_v2.forms_components.dialog_box","width":240,"height":116,"lockAspectRatio":false,"lockShape":false,"order":1,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.dialog_box.ui_v2","strokeWidth":2,"strokeColor":"#000000","fillColor":"#FFFFFF","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2,"y":0,"rotation":0,"id":37,"uid":null,"width":236,"height":14,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"top","overflow":"none","vposition":"none","hposition":"none","html":"

Terminal

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]}],"background":"#FFFFFF","width":880,"height":478,"maxWidth":5000,"maxHeight":5000,"nodeIndex":39,"autoFit":true,"exportBorder":false,"gridOn":true,"snapToGrid":true,"drawingGuidesOn":true,"pageBreaksOn":false,"printGridOn":false,"printPaper":"LETTER","printShrinkToFit":false,"printPortrait":true,"shapeStyles":{"com.gliffy.shape.basic.basic_v1.default":{"fill":"#9fc5e8","stroke":"#ffffff","strokeWidth":2,"gradient":false,"shadow":true},"com.gliffy.shape.network.network_v3.home":{"fill":"#cfe2f3"},"com.gliffy.shape.sitemap.sitemap_v1.default":{"fill":"#6699CC","stroke":"#999999","strokeWidth":2}},"lineStyles":{},"textStyles":{},"themeData":null}} -------------------------------------------------------------------------------- /images/todatauri.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/todatauri.png -------------------------------------------------------------------------------- /images/yummly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idjs/belajar-nodejs/4342a5b98177f070ef42952e1cb060f7e7610b29/images/yummly.png -------------------------------------------------------------------------------- /index.jade: -------------------------------------------------------------------------------- 1 | !!! 2 | html 3 | head 4 | link(rel="stylesheet", href="style/github.css") 5 | body 6 | .container 7 | include README.md 8 | -------------------------------------------------------------------------------- /pengarang/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Tentang Pengarang | Pengenalan Node.js 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
50 | 51 | 52 |
53 | 839 |
840 | 841 |
842 |
843 | 853 | 854 |
855 |
856 | 857 | 858 |
859 | 860 |

Tentang Pengarang

861 |

Equan Pr. adalah developer NodeJS dan peminum kopi kelas berat. Selalu sibuk dengan yang berbau JavaScript ketika di depan komputer, penggila film & musik metal dan kadang-kadang nge-twit di @junwatu atau nge-Github.

862 | 863 | 864 |
865 | 866 | 867 |
868 |
869 |
870 | 871 | 872 | 873 | 874 | 875 |
876 |
877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 903 | 904 | 905 | 906 | 907 | 908 | -------------------------------------------------------------------------------- /server_file_statis/kode.md: -------------------------------------------------------------------------------- 1 | # Kode 2 | 3 | Agar server Node.js bisa mengirimkan file statis ke klien maka server perlu mengetahui `path` atau tempat dimana file tersebut berada. 4 | 5 | Node.js bisa mengirimkan file tersebut secara streaming melalui fungsi [`fs.createReadStream()`](http://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options). Sebelum dijelaskan lebih lanjut mungkin bisa dilihat atau di coba saja server file Node.js dibawah ini 6 | 7 | [`server-file.js`](https://raw.github.com/idjs/belajar-nodejs/gh-pages/code/server-file/server-file.js) 8 | 9 | ``` 10 | var http = require('http'), 11 | parse = require('url').parse, 12 | join = require('path').join, 13 | fs = require('fs'), 14 | root = join(__dirname, 'www'), 15 | PORT = 3300, 16 | 17 | server = http.createServer(function(req, res){ 18 | var url = parse(req.url), 19 | path = join(root, url.pathname), 20 | stream = fs.createReadStream(path); 21 | 22 | stream.on('data', function(bagian){ 23 | res.write(bagian); 24 | }); 25 | 26 | stream.on('end', function(){ 27 | res.end(); 28 | }); 29 | 30 | stream.on('error', function(){ 31 | res.setHeader('Content-Type','text/html'); 32 | 33 | var url_demo = "http://localhost:"+PORT+"/index.html"; 34 | res.write("coba buka "+url_demo+""); 35 | res.end(); 36 | }) 37 | 38 | }); 39 | 40 | server.listen(PORT); 41 | console.log('Port '+PORT+': Server File '); 42 | 43 | ``` 44 | 45 | Berikut sedikit penjelasan dari kode diatas 46 | 47 | - [`__dirname`](http://nodejs.org/api/globals.html#globals_dirname) merupakan variabel global yang disediakan oleh Node.js yang berisi path direktori dari file yang sedang aktif mengeksekusi `__dirname`. 48 | - `root` merupakan direktori root atau referensi tempat dimana file-file yang akan dikirimkan oleh server Node.js. Pada kode server diatas direktori root di setting pada direktori `www`. 49 | - `path` adalah path file yang bisa didapatkan dengan menggabungkan path direktori root dan `pathname`. `pathname` yang dimaksud di sini misalnya jika URL yang diminta yaitu `http://localhost:3300/index.html` maka `pathname` adalah `/index.html`. Nilai variabel `path` dihasilkan dengan memakai fungsi `join()`. 50 | 51 | ``` 52 | var path = join(root, url.pathname) 53 | ``` 54 | 55 | - `stream` yang di kembalikan oleh fungsi `fs.createReadStream()` merupakan class [`stream.Readable`](http://nodejs.org/api/stream.html#stream_class_stream_readable). Objek `stream` ini mengeluarkan data secara streaming untuk di olah lebih lanjut. Perlu menjadi catatan bahwa `stream.Readable` tidak akan mengeluarkan data jikalau tidak di kehendaki. Nah...cara untuk mendeteksi data streaming ini sudah siap di konsumsi atau belum adalah melalui event. 56 | 57 | Event yang di dukung oleh class `stream.Readable` adalah sebagai berikut 58 | 59 | 60 | - Event: `readable` 61 | - Event: `data` 62 | - Event: `end` 63 | - Event: `error` 64 | - Event: `close` 65 | 66 | 67 | Mungkin anda bertanya kenapa server file statis diatas memakai metode stream, bukankah menyediakan file secara langsung saja sudah bisa? jawabannya memang bisa tetapi mungkin tidak akan efisien kalau file yang akan di berikan ke client mempunyai ukuran yang cukup besar. Coba lihat kode berikut ini 68 | 69 | ``` 70 | var http = require('http'); 71 | var fs = require('fs'); 72 | 73 | var server = http.createServer(function (req, res) { 74 | fs.readFile(__dirname + '/data.txt', function (err, data) { 75 | res.end(data); 76 | }); 77 | }); 78 | server.listen(8000); 79 | 80 | ``` 81 | Jika file `data.txt` ukurannya terlalu besar maka buffer yang digunakan oleh sistem juga besar sehingga konsumsi memori juga akan bertambah besar seiring semakin banyak pengguna yang mengakses file ini. 82 | 83 | Jika anda ingin lebih banyak mendalami tentang Node.js Stream silahkan lihat resource berikut (dalam Bahasa Inggris) 84 | 85 | - [Node.js API Stream](http://nodejs.org/api/stream.html) 86 | - [Stream Handbook](https://github.com/substack/stream-handbook) 87 | 88 | 89 |
90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /style/base.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skeleton V1.2 3 | * Copyright 2011, Dave Gamache 4 | * www.getskeleton.com 5 | * Free to use under the MIT license. 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 6/20/2012 8 | */ 9 | 10 | 11 | /* Table of Content 12 | ================================================== 13 | #Reset & Basics 14 | #Basic Styles 15 | #Site Styles 16 | #Typography 17 | #Links 18 | #Lists 19 | #Images 20 | #Buttons 21 | #Forms 22 | #Misc */ 23 | 24 | 25 | /* #Reset & Basics (Inspired by E. Meyers) 26 | ================================================== */ 27 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { 28 | margin: 0; 29 | padding: 0; 30 | border: 0; 31 | font-size: 100%; 32 | font: inherit; 33 | vertical-align: baseline; } 34 | article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { 35 | display: block; } 36 | body { 37 | line-height: 1; } 38 | ol, ul { 39 | list-style: none; } 40 | blockquote, q { 41 | quotes: none; } 42 | blockquote:before, blockquote:after, 43 | q:before, q:after { 44 | content: ''; 45 | content: none; } 46 | table { 47 | border-collapse: collapse; 48 | border-spacing: 0; } 49 | 50 | 51 | /* #Basic Styles 52 | ================================================== */ 53 | body { 54 | background: #fff; 55 | font: 14px/21px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; 56 | color: #444; 57 | -webkit-font-smoothing: antialiased; /* Fix for webkit rendering */ 58 | -webkit-text-size-adjust: 100%; 59 | } 60 | 61 | 62 | /* #Typography 63 | ================================================== */ 64 | h1, h2, h3, h4, h5, h6 { 65 | color: #181818; 66 | font-family: "Georgia", "Times New Roman", serif; 67 | font-weight: normal; } 68 | h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-weight: inherit; } 69 | h1 { font-size: 46px; line-height: 50px; margin-bottom: 14px;} 70 | h2 { font-size: 35px; line-height: 40px; margin-bottom: 10px; } 71 | h3 { font-size: 28px; line-height: 34px; margin-bottom: 8px; } 72 | h4 { font-size: 21px; line-height: 30px; margin-bottom: 4px; } 73 | h5 { font-size: 17px; line-height: 24px; } 74 | h6 { font-size: 14px; line-height: 21px; } 75 | .subheader { color: #777; } 76 | 77 | p { margin: 0 0 20px 0; } 78 | p img { margin: 0; } 79 | p.lead { font-size: 21px; line-height: 27px; color: #777; } 80 | 81 | em { font-style: italic; } 82 | strong { font-weight: bold; color: #333; } 83 | small { font-size: 80%; } 84 | 85 | /* Blockquotes */ 86 | blockquote, blockquote p { font-size: 17px; line-height: 24px; color: #777; font-style: italic; } 87 | blockquote { margin: 0 0 20px; padding: 9px 20px 0 19px; border-left: 1px solid #ddd; } 88 | blockquote cite { display: block; font-size: 12px; color: #555; } 89 | blockquote cite:before { content: "\2014 \0020"; } 90 | blockquote cite a, blockquote cite a:visited, blockquote cite a:visited { color: #555; } 91 | 92 | hr { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 10px 0 30px; height: 0; } 93 | 94 | 95 | /* #Links 96 | ================================================== */ 97 | a, a:visited { color: #333; text-decoration: underline; outline: 0; } 98 | a:hover, a:focus { color: #000; } 99 | p a, p a:visited { line-height: inherit; } 100 | 101 | 102 | /* #Lists 103 | ================================================== */ 104 | ul, ol { margin-bottom: 20px; } 105 | ul { list-style: none outside; } 106 | ol { list-style: decimal; } 107 | ol, ul.square, ul.circle, ul.disc { margin-left: 30px; } 108 | ul.square { list-style: square outside; } 109 | ul.circle { list-style: circle outside; } 110 | ul.disc { list-style: disc outside; } 111 | ul ul, ul ol, 112 | ol ol, ol ul { margin: 4px 0 5px 30px; font-size: 90%; } 113 | ul ul li, ul ol li, 114 | ol ol li, ol ul li { margin-bottom: 6px; } 115 | li { line-height: 18px; margin-bottom: 12px; } 116 | ul.large li { line-height: 21px; } 117 | li p { line-height: 21px; } 118 | 119 | /* #Images 120 | ================================================== */ 121 | 122 | img.scale-with-grid { 123 | max-width: 100%; 124 | height: auto; } 125 | 126 | 127 | /* #Buttons 128 | ================================================== */ 129 | 130 | .button, 131 | button, 132 | input[type="submit"], 133 | input[type="reset"], 134 | input[type="button"] { 135 | background: #eee; /* Old browsers */ 136 | background: #eee -moz-linear-gradient(top, rgba(255,255,255,.2) 0%, rgba(0,0,0,.2) 100%); /* FF3.6+ */ 137 | background: #eee -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.2)), color-stop(100%,rgba(0,0,0,.2))); /* Chrome,Safari4+ */ 138 | background: #eee -webkit-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Chrome10+,Safari5.1+ */ 139 | background: #eee -o-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Opera11.10+ */ 140 | background: #eee -ms-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* IE10+ */ 141 | background: #eee linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* W3C */ 142 | border: 1px solid #aaa; 143 | border-top: 1px solid #ccc; 144 | border-left: 1px solid #ccc; 145 | -moz-border-radius: 3px; 146 | -webkit-border-radius: 3px; 147 | border-radius: 3px; 148 | color: #444; 149 | display: inline-block; 150 | font-size: 11px; 151 | font-weight: bold; 152 | text-decoration: none; 153 | text-shadow: 0 1px rgba(255, 255, 255, .75); 154 | cursor: pointer; 155 | margin-bottom: 20px; 156 | line-height: normal; 157 | padding: 8px 10px; 158 | font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; } 159 | 160 | .button:hover, 161 | button:hover, 162 | input[type="submit"]:hover, 163 | input[type="reset"]:hover, 164 | input[type="button"]:hover { 165 | color: #222; 166 | background: #ddd; /* Old browsers */ 167 | background: #ddd -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); /* FF3.6+ */ 168 | background: #ddd -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.3)), color-stop(100%,rgba(0,0,0,.3))); /* Chrome,Safari4+ */ 169 | background: #ddd -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Chrome10+,Safari5.1+ */ 170 | background: #ddd -o-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Opera11.10+ */ 171 | background: #ddd -ms-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* IE10+ */ 172 | background: #ddd linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* W3C */ 173 | border: 1px solid #888; 174 | border-top: 1px solid #aaa; 175 | border-left: 1px solid #aaa; } 176 | 177 | .button:active, 178 | button:active, 179 | input[type="submit"]:active, 180 | input[type="reset"]:active, 181 | input[type="button"]:active { 182 | border: 1px solid #666; 183 | background: #ccc; /* Old browsers */ 184 | background: #ccc -moz-linear-gradient(top, rgba(255,255,255,.35) 0%, rgba(10,10,10,.4) 100%); /* FF3.6+ */ 185 | background: #ccc -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.35)), color-stop(100%,rgba(10,10,10,.4))); /* Chrome,Safari4+ */ 186 | background: #ccc -webkit-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Chrome10+,Safari5.1+ */ 187 | background: #ccc -o-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Opera11.10+ */ 188 | background: #ccc -ms-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* IE10+ */ 189 | background: #ccc linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* W3C */ } 190 | 191 | .button.full-width, 192 | button.full-width, 193 | input[type="submit"].full-width, 194 | input[type="reset"].full-width, 195 | input[type="button"].full-width { 196 | width: 100%; 197 | padding-left: 0 !important; 198 | padding-right: 0 !important; 199 | text-align: center; } 200 | 201 | /* Fix for odd Mozilla border & padding issues */ 202 | button::-moz-focus-inner, 203 | input::-moz-focus-inner { 204 | border: 0; 205 | padding: 0; 206 | } 207 | 208 | 209 | /* #Forms 210 | ================================================== */ 211 | 212 | form { 213 | margin-bottom: 20px; } 214 | fieldset { 215 | margin-bottom: 20px; } 216 | input[type="text"], 217 | input[type="password"], 218 | input[type="email"], 219 | textarea, 220 | select { 221 | border: 1px solid #ccc; 222 | padding: 6px 4px; 223 | outline: none; 224 | -moz-border-radius: 2px; 225 | -webkit-border-radius: 2px; 226 | border-radius: 2px; 227 | font: 13px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; 228 | color: #777; 229 | margin: 0; 230 | width: 210px; 231 | max-width: 100%; 232 | display: block; 233 | margin-bottom: 20px; 234 | background: #fff; } 235 | select { 236 | padding: 0; } 237 | input[type="text"]:focus, 238 | input[type="password"]:focus, 239 | input[type="email"]:focus, 240 | textarea:focus { 241 | border: 1px solid #aaa; 242 | color: #444; 243 | -moz-box-shadow: 0 0 3px rgba(0,0,0,.2); 244 | -webkit-box-shadow: 0 0 3px rgba(0,0,0,.2); 245 | box-shadow: 0 0 3px rgba(0,0,0,.2); } 246 | textarea { 247 | min-height: 60px; } 248 | label, 249 | legend { 250 | display: block; 251 | font-weight: bold; 252 | font-size: 13px; } 253 | select { 254 | width: 220px; } 255 | input[type="checkbox"] { 256 | display: inline; } 257 | label span, 258 | legend span { 259 | font-weight: normal; 260 | font-size: 13px; 261 | color: #444; } 262 | 263 | /* #Misc 264 | ================================================== */ 265 | .remove-bottom { margin-bottom: 0 !important; } 266 | .half-bottom { margin-bottom: 10px !important; } 267 | .add-bottom { margin-bottom: 20px !important; } 268 | 269 | 270 | -------------------------------------------------------------------------------- /style/github.less: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Helvetica, arial, sans-serif; 3 | font-size: 15px; 4 | line-height: 1.7; 5 | padding-top: 10px; 6 | padding-bottom: 10px; 7 | background-color: white; 8 | padding: 30px; 9 | color: #333; 10 | } 11 | 12 | body > *:first-child { 13 | margin-top: 0 !important; 14 | } 15 | 16 | body > *:last-child { 17 | margin-bottom: 0 !important; 18 | } 19 | 20 | a { 21 | color: #4183C4; 22 | text-decoration: none; 23 | } 24 | 25 | a.absent { 26 | color: #cc0000; 27 | } 28 | 29 | a.anchor { 30 | display: block; 31 | padding-left: 30px; 32 | margin-left: -30px; 33 | cursor: pointer; 34 | position: absolute; 35 | top: 0; 36 | left: 0; 37 | bottom: 0; 38 | } 39 | 40 | h1, h2, h3, h4, h5, h6 { 41 | margin: 20px 0 10px; 42 | padding: 0; 43 | font-weight: bold; 44 | -webkit-font-smoothing: antialiased; 45 | cursor: text; 46 | position: relative; 47 | } 48 | 49 | h2:first-child, h1:first-child, h1:first-child + h2, h3:first-child, h4:first-child, h5:first-child, h6:first-child { 50 | margin-top: 0; 51 | padding-top: 0; 52 | } 53 | 54 | h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor { 55 | text-decoration: none; 56 | } 57 | 58 | h1 tt, h1 code { 59 | font-size: inherit; 60 | } 61 | 62 | h2 tt, h2 code { 63 | font-size: inherit; 64 | } 65 | 66 | h3 tt, h3 code { 67 | font-size: inherit; 68 | } 69 | 70 | h4 tt, h4 code { 71 | font-size: inherit; 72 | } 73 | 74 | h5 tt, h5 code { 75 | font-size: inherit; 76 | } 77 | 78 | h6 tt, h6 code { 79 | font-size: inherit; 80 | } 81 | 82 | h1 { 83 | font-size: 28px; 84 | color: black; 85 | } 86 | 87 | h2 { 88 | font-size: 24px; 89 | border-bottom: 1px solid #cccccc; 90 | color: black; 91 | } 92 | 93 | h3 { 94 | font-size: 18px; 95 | } 96 | 97 | h4 { 98 | font-size: 16px; 99 | } 100 | 101 | h5 { 102 | font-size: 14px; 103 | } 104 | 105 | h6 { 106 | color: #777777; 107 | font-size: 14px; 108 | } 109 | 110 | p, blockquote, ul, ol, dl, li, table, pre { 111 | margin: 15px 0; 112 | } 113 | 114 | hr { 115 | background: transparent url("http://tinyurl.com/bq5kskr") repeat-x 0 0; 116 | border: 0 none; 117 | color: #cccccc; 118 | height: 4px; 119 | padding: 0; 120 | } 121 | 122 | body > h2:first-child { 123 | margin-top: 0; 124 | padding-top: 0; 125 | } 126 | 127 | body > h1:first-child { 128 | margin-top: 0; 129 | padding-top: 0; 130 | } 131 | 132 | body > h1:first-child + h2 { 133 | margin-top: 0; 134 | padding-top: 0; 135 | } 136 | 137 | body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child { 138 | margin-top: 0; 139 | padding-top: 0; 140 | } 141 | 142 | a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 { 143 | margin-top: 0; 144 | padding-top: 0; 145 | } 146 | 147 | h1 p, h2 p, h3 p, h4 p, h5 p, h6 p { 148 | margin-top: 0; 149 | } 150 | 151 | li p.first { 152 | display: inline-block; 153 | } 154 | 155 | ul, ol { 156 | padding-left: 30px; 157 | } 158 | 159 | ul :first-child, ol :first-child { 160 | margin-top: 0; 161 | } 162 | 163 | ul :last-child, ol :last-child { 164 | margin-bottom: 0; 165 | } 166 | 167 | dl { 168 | padding: 0; 169 | } 170 | 171 | dl dt { 172 | font-size: 14px; 173 | font-weight: bold; 174 | font-style: italic; 175 | padding: 0; 176 | margin: 15px 0 5px; 177 | } 178 | 179 | dl dt:first-child { 180 | padding: 0; 181 | } 182 | 183 | dl dt > :first-child { 184 | margin-top: 0; 185 | } 186 | 187 | dl dt > :last-child { 188 | margin-bottom: 0; 189 | } 190 | 191 | dl dd { 192 | margin: 0 0 15px; 193 | padding: 0 15px; 194 | } 195 | 196 | dl dd > :first-child { 197 | margin-top: 0; 198 | } 199 | 200 | dl dd > :last-child { 201 | margin-bottom: 0; 202 | } 203 | 204 | blockquote { 205 | border-left: 4px solid #dddddd; 206 | padding: 0 15px; 207 | color: #777777; 208 | } 209 | 210 | blockquote > :first-child { 211 | margin-top: 0; 212 | } 213 | 214 | blockquote > :last-child { 215 | margin-bottom: 0; 216 | } 217 | 218 | table { 219 | padding: 0; 220 | } 221 | table tr { 222 | border-top: 1px solid #cccccc; 223 | background-color: white; 224 | margin: 0; 225 | padding: 0; 226 | } 227 | 228 | table tr:nth-child(2n) { 229 | background-color: #f8f8f8; 230 | } 231 | 232 | table tr th { 233 | font-weight: bold; 234 | border: 1px solid #cccccc; 235 | text-align: left; 236 | margin: 0; 237 | padding: 6px 13px; 238 | } 239 | 240 | table tr td { 241 | border: 1px solid #cccccc; 242 | text-align: left; 243 | margin: 0; 244 | padding: 6px 13px; 245 | } 246 | 247 | table tr th :first-child, table tr td :first-child { 248 | margin-top: 0; 249 | } 250 | 251 | table tr th :last-child, table tr td :last-child { 252 | margin-bottom: 0; 253 | } 254 | 255 | img { 256 | max-width: 100%; 257 | } 258 | 259 | span.frame { 260 | display: block; 261 | overflow: hidden; 262 | } 263 | 264 | span.frame > span { 265 | border: 1px solid #dddddd; 266 | display: block; 267 | float: left; 268 | overflow: hidden; 269 | margin: 13px 0 0; 270 | padding: 7px; 271 | width: auto; 272 | } 273 | 274 | span.frame span img { 275 | display: block; 276 | float: left; 277 | } 278 | 279 | span.frame span span { 280 | clear: both; 281 | color: #333333; 282 | display: block; 283 | padding: 5px 0 0; 284 | } 285 | 286 | span.align-center { 287 | display: block; 288 | overflow: hidden; 289 | clear: both; 290 | } 291 | 292 | span.align-center > span { 293 | display: block; 294 | overflow: hidden; 295 | margin: 13px auto 0; 296 | text-align: center; 297 | } 298 | 299 | span.align-center span img { 300 | margin: 0 auto; 301 | text-align: center; 302 | } 303 | 304 | span.align-right { 305 | display: block; 306 | overflow: hidden; 307 | clear: both; 308 | } 309 | 310 | span.align-right > span { 311 | display: block; 312 | overflow: hidden; 313 | margin: 13px 0 0; 314 | text-align: right; 315 | } 316 | 317 | span.align-right span img { 318 | margin: 0; 319 | text-align: right; 320 | } 321 | 322 | span.float-left { 323 | display: block; 324 | margin-right: 13px; 325 | overflow: hidden; 326 | float: left; 327 | } 328 | 329 | span.float-left span { 330 | margin: 13px 0 0; 331 | } 332 | 333 | span.float-right { 334 | display: block; 335 | margin-left: 13px; 336 | overflow: hidden; 337 | float: right; 338 | } 339 | 340 | span.float-right > span { 341 | display: block; 342 | overflow: hidden; 343 | margin: 13px auto 0; 344 | text-align: right; 345 | } 346 | 347 | code, tt { 348 | margin: 0 2px; 349 | padding: 0 5px; 350 | white-space: nowrap; 351 | border: 1px solid #eaeaea; 352 | background-color: #f8f8f8; 353 | border-radius: 3px; 354 | } 355 | 356 | pre code { 357 | margin: 0; 358 | padding: 0; 359 | white-space: pre; 360 | border: none; 361 | background: transparent; 362 | } 363 | 364 | .highlight pre { 365 | background-color: #f8f8f8; 366 | border: 1px solid #cccccc; 367 | font-size: 13px; 368 | line-height: 19px; 369 | overflow: auto; 370 | padding: 6px 10px; 371 | border-radius: 3px; 372 | } 373 | 374 | pre { 375 | background-color: #f8f8f8; 376 | border: 1px solid #cccccc; 377 | font-size: 13px; 378 | line-height: 19px; 379 | overflow: auto; 380 | padding: 6px 10px; 381 | border-radius: 3px; 382 | } 383 | 384 | pre code, pre tt { 385 | background-color: transparent; 386 | border: none; 387 | } 388 | 389 | 390 | .container{ 391 | width:980px; 392 | margin-left:auto; 393 | margin-right:auto; 394 | padding:0 10px 395 | } 396 | 397 | .container:before,.container:after{ 398 | content:" "; 399 | display:table 400 | } 401 | 402 | .container:after{ 403 | clear:both 404 | } 405 | -------------------------------------------------------------------------------- /style/layout.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skeleton V1.2 3 | * Copyright 2011, Dave Gamache 4 | * www.getskeleton.com 5 | * Free to use under the MIT license. 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 6/20/2012 8 | */ 9 | 10 | /* Table of Content 11 | ================================================== 12 | #Site Styles 13 | #Page Styles 14 | #Media Queries 15 | #Font-Face */ 16 | 17 | /* #Site Styles 18 | ================================================== */ 19 | 20 | /* #Page Styles 21 | ================================================== */ 22 | 23 | /* #Media Queries 24 | ================================================== */ 25 | 26 | /* Smaller than standard 960 (devices and browsers) */ 27 | @media only screen and (max-width: 959px) {} 28 | 29 | /* Tablet Portrait size to standard 960 (devices and browsers) */ 30 | @media only screen and (min-width: 768px) and (max-width: 959px) {} 31 | 32 | /* All Mobile Sizes (devices and browser) */ 33 | @media only screen and (max-width: 767px) {} 34 | 35 | /* Mobile Landscape Size to Tablet Portrait (devices and browsers) */ 36 | @media only screen and (min-width: 480px) and (max-width: 767px) {} 37 | 38 | /* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */ 39 | @media only screen and (max-width: 479px) {} 40 | 41 | 42 | /* #Font-Face 43 | ================================================== */ 44 | /* This is the proper syntax for an @font-face file 45 | Just create a "fonts" folder at the root, 46 | copy your FontName into code below and remove 47 | comment brackets */ 48 | 49 | /* @font-face { 50 | font-family: 'FontName'; 51 | src: url('../fonts/FontName.eot'); 52 | src: url('../fonts/FontName.eot?iefix') format('eot'), 53 | url('../fonts/FontName.woff') format('woff'), 54 | url('../fonts/FontName.ttf') format('truetype'), 55 | url('../fonts/FontName.svg#webfontZam02nTh') format('svg'); 56 | font-weight: normal; 57 | font-style: normal; } 58 | */ -------------------------------------------------------------------------------- /style/main.css: -------------------------------------------------------------------------------- 1 | .main-header { 2 | margin-top: 30px; 3 | } 4 | 5 | .social-header { 6 | text-align: center; 7 | margin-top: 50px; 8 | } 9 | 10 | .author { 11 | font-weight: bold; 12 | } 13 | 14 | .content { 15 | margin-top: 50px; 16 | } 17 | 18 | .daftar-isi { 19 | margin-top: 50px; 20 | margin-bottom: 20px; 21 | } 22 | 23 | .daftar-isi ul li { 24 | margin-left: 15px; 25 | list-style: circle; 26 | } 27 | 28 | .paragraph { 29 | text-align: justify; 30 | } 31 | 32 | /* code styling ala github flavor*/ 33 | p code { 34 | margin: 0 2px; 35 | padding: 0px 5px; 36 | border: 1px solid #ddd; 37 | background-color: #f8f8f8; 38 | border-radius: 3px; 39 | } 40 | /* code styling ala github flavor*/ 41 | code { 42 | margin: 0 2px; 43 | padding: 0px 5px; 44 | border: 1px solid #ddd; 45 | background-color: #f8f8f8; 46 | border-radius: 3px; 47 | } -------------------------------------------------------------------------------- /style/skeleton.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skeleton V1.2 3 | * Copyright 2011, Dave Gamache 4 | * www.getskeleton.com 5 | * Free to use under the MIT license. 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 6/20/2012 8 | */ 9 | 10 | 11 | /* Table of Contents 12 | ================================================== 13 | #Base 960 Grid 14 | #Tablet (Portrait) 15 | #Mobile (Portrait) 16 | #Mobile (Landscape) 17 | #Clearing */ 18 | 19 | 20 | 21 | /* #Base 960 Grid 22 | ================================================== */ 23 | 24 | .container { position: relative; width: 960px; margin: 0 auto; padding: 0; } 25 | .container .column, 26 | .container .columns { float: left; display: inline; margin-left: 10px; margin-right: 10px; } 27 | .row { margin-bottom: 20px; } 28 | 29 | /* Nested Column Classes */ 30 | .column.alpha, .columns.alpha { margin-left: 0; } 31 | .column.omega, .columns.omega { margin-right: 0; } 32 | 33 | /* Base Grid */ 34 | .container .one.column, 35 | .container .one.columns { width: 40px; } 36 | .container .two.columns { width: 100px; } 37 | .container .three.columns { width: 160px; } 38 | .container .four.columns { width: 220px; } 39 | .container .five.columns { width: 280px; } 40 | .container .six.columns { width: 340px; } 41 | .container .seven.columns { width: 400px; } 42 | .container .eight.columns { width: 460px; } 43 | .container .nine.columns { width: 520px; } 44 | .container .ten.columns { width: 580px; } 45 | .container .eleven.columns { width: 640px; } 46 | .container .twelve.columns { width: 700px; } 47 | .container .thirteen.columns { width: 760px; } 48 | .container .fourteen.columns { width: 820px; } 49 | .container .fifteen.columns { width: 880px; } 50 | .container .sixteen.columns { width: 940px; } 51 | 52 | .container .one-third.column { width: 300px; } 53 | .container .two-thirds.column { width: 620px; } 54 | 55 | /* Offsets */ 56 | .container .offset-by-one { padding-left: 60px; } 57 | .container .offset-by-two { padding-left: 120px; } 58 | .container .offset-by-three { padding-left: 180px; } 59 | .container .offset-by-four { padding-left: 240px; } 60 | .container .offset-by-five { padding-left: 300px; } 61 | .container .offset-by-six { padding-left: 360px; } 62 | .container .offset-by-seven { padding-left: 420px; } 63 | .container .offset-by-eight { padding-left: 480px; } 64 | .container .offset-by-nine { padding-left: 540px; } 65 | .container .offset-by-ten { padding-left: 600px; } 66 | .container .offset-by-eleven { padding-left: 660px; } 67 | .container .offset-by-twelve { padding-left: 720px; } 68 | .container .offset-by-thirteen { padding-left: 780px; } 69 | .container .offset-by-fourteen { padding-left: 840px; } 70 | .container .offset-by-fifteen { padding-left: 900px; } 71 | 72 | 73 | 74 | /* #Tablet (Portrait) 75 | ================================================== */ 76 | 77 | /* Note: Design for a width of 768px */ 78 | 79 | @media only screen and (min-width: 768px) and (max-width: 959px) { 80 | .container { width: 768px; } 81 | .container .column, 82 | .container .columns { margin-left: 10px; margin-right: 10px; } 83 | .column.alpha, .columns.alpha { margin-left: 0; margin-right: 10px; } 84 | .column.omega, .columns.omega { margin-right: 0; margin-left: 10px; } 85 | .alpha.omega { margin-left: 0; margin-right: 0; } 86 | 87 | .container .one.column, 88 | .container .one.columns { width: 28px; } 89 | .container .two.columns { width: 76px; } 90 | .container .three.columns { width: 124px; } 91 | .container .four.columns { width: 172px; } 92 | .container .five.columns { width: 220px; } 93 | .container .six.columns { width: 268px; } 94 | .container .seven.columns { width: 316px; } 95 | .container .eight.columns { width: 364px; } 96 | .container .nine.columns { width: 412px; } 97 | .container .ten.columns { width: 460px; } 98 | .container .eleven.columns { width: 508px; } 99 | .container .twelve.columns { width: 556px; } 100 | .container .thirteen.columns { width: 604px; } 101 | .container .fourteen.columns { width: 652px; } 102 | .container .fifteen.columns { width: 700px; } 103 | .container .sixteen.columns { width: 748px; } 104 | 105 | .container .one-third.column { width: 236px; } 106 | .container .two-thirds.column { width: 492px; } 107 | 108 | /* Offsets */ 109 | .container .offset-by-one { padding-left: 48px; } 110 | .container .offset-by-two { padding-left: 96px; } 111 | .container .offset-by-three { padding-left: 144px; } 112 | .container .offset-by-four { padding-left: 192px; } 113 | .container .offset-by-five { padding-left: 240px; } 114 | .container .offset-by-six { padding-left: 288px; } 115 | .container .offset-by-seven { padding-left: 336px; } 116 | .container .offset-by-eight { padding-left: 384px; } 117 | .container .offset-by-nine { padding-left: 432px; } 118 | .container .offset-by-ten { padding-left: 480px; } 119 | .container .offset-by-eleven { padding-left: 528px; } 120 | .container .offset-by-twelve { padding-left: 576px; } 121 | .container .offset-by-thirteen { padding-left: 624px; } 122 | .container .offset-by-fourteen { padding-left: 672px; } 123 | .container .offset-by-fifteen { padding-left: 720px; } 124 | } 125 | 126 | 127 | /* #Mobile (Portrait) 128 | ================================================== */ 129 | 130 | /* Note: Design for a width of 320px */ 131 | 132 | @media only screen and (max-width: 767px) { 133 | .container { width: 300px; } 134 | .container .columns, 135 | .container .column { margin: 0; } 136 | 137 | .container .one.column, 138 | .container .one.columns, 139 | .container .two.columns, 140 | .container .three.columns, 141 | .container .four.columns, 142 | .container .five.columns, 143 | .container .six.columns, 144 | .container .seven.columns, 145 | .container .eight.columns, 146 | .container .nine.columns, 147 | .container .ten.columns, 148 | .container .eleven.columns, 149 | .container .twelve.columns, 150 | .container .thirteen.columns, 151 | .container .fourteen.columns, 152 | .container .fifteen.columns, 153 | .container .sixteen.columns, 154 | .container .one-third.column, 155 | .container .two-thirds.column { width: 300px; } 156 | 157 | /* Offsets */ 158 | .container .offset-by-one, 159 | .container .offset-by-two, 160 | .container .offset-by-three, 161 | .container .offset-by-four, 162 | .container .offset-by-five, 163 | .container .offset-by-six, 164 | .container .offset-by-seven, 165 | .container .offset-by-eight, 166 | .container .offset-by-nine, 167 | .container .offset-by-ten, 168 | .container .offset-by-eleven, 169 | .container .offset-by-twelve, 170 | .container .offset-by-thirteen, 171 | .container .offset-by-fourteen, 172 | .container .offset-by-fifteen { padding-left: 0; } 173 | 174 | } 175 | 176 | 177 | /* #Mobile (Landscape) 178 | ================================================== */ 179 | 180 | /* Note: Design for a width of 480px */ 181 | 182 | @media only screen and (min-width: 480px) and (max-width: 767px) { 183 | .container { width: 420px; } 184 | .container .columns, 185 | .container .column { margin: 0; } 186 | 187 | .container .one.column, 188 | .container .one.columns, 189 | .container .two.columns, 190 | .container .three.columns, 191 | .container .four.columns, 192 | .container .five.columns, 193 | .container .six.columns, 194 | .container .seven.columns, 195 | .container .eight.columns, 196 | .container .nine.columns, 197 | .container .ten.columns, 198 | .container .eleven.columns, 199 | .container .twelve.columns, 200 | .container .thirteen.columns, 201 | .container .fourteen.columns, 202 | .container .fifteen.columns, 203 | .container .sixteen.columns, 204 | .container .one-third.column, 205 | .container .two-thirds.column { width: 420px; } 206 | } 207 | 208 | 209 | /* #Clearing 210 | ================================================== */ 211 | 212 | /* Self Clearing Goodness */ 213 | .container:after { content: "\0020"; display: block; height: 0; clear: both; visibility: hidden; } 214 | 215 | /* Use clearfix class on parent to clear nested columns, 216 | or wrap each row of columns in a
*/ 217 | .clearfix:before, 218 | .clearfix:after, 219 | .row:before, 220 | .row:after { 221 | content: '\0020'; 222 | display: block; 223 | overflow: hidden; 224 | visibility: hidden; 225 | width: 0; 226 | height: 0; } 227 | .row:after, 228 | .clearfix:after { 229 | clear: both; } 230 | .row, 231 | .clearfix { 232 | zoom: 1; } 233 | 234 | /* You can also use a
to clear columns */ 235 | .clear { 236 | clear: both; 237 | display: block; 238 | overflow: hidden; 239 | visibility: hidden; 240 | width: 0; 241 | height: 0; 242 | } 243 | -------------------------------------------------------------------------------- /testing/mocha.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Mocha | Pengenalan Node.js 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
52 | 53 | 54 |
55 | 826 |
827 | 828 |
829 |
830 | 840 | 841 |
842 |
843 | 844 | 845 |
846 | 847 |

Mocha

848 |

Mocha termasuk pustaka pengetesan yang bisa dipakai secara BDD ataupun TDD. Pustaka ini secara default memakai style BDD. Metode umum BDD adalah seperti describe, it, beforeEach, beforeAfter, before, after.

849 | 850 | 851 |
852 | 853 | 854 |
855 |
856 |
857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 |
865 |
866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 892 | 893 | 894 | 895 | 896 | 897 | --------------------------------------------------------------------------------