Ini blog sedikit alay, lebay dan suka berlebihan (kayak gue "Nita").

Kamis, 23 Oktober 2014

Tugas Day 3: Web GoLang (SECRET!)

“Bingung gimana bikin tutorialnya. Penuh sensor. Hahah.”
Yang umum-umum aja dah yang dibagi.
Hari ini nge-GoLang lagi. Ranahnya udah masuk ke web.
Judul spesifiknya sih bikin halaman “web statis”. Web statis ini maksudnya data dan informasi yang ada di web statis nggak berubah-ubah. Terus dokumen web yang sampai di client isinya sama kayak apa yang ada di web server.
“The web applications are based on HTTP protocol, and Go provides fully ability for HTTP in package net/http, it's very easy to setup a web server by using this package.” Ini nih alesannya kenapa nge-Go.
Pertama-tama. Buka ini dulu:

Terus bikin folder buat nyimpen file html nya. Terserah mo disimpen dimanah. Kalo yang lagi dibuat ini di folder login.

Ini isinya login:

Kalo Idea nya udah kebuka, create new project. Kasih nama project nya apa aja terserah deh lalu masuk ke src.
Bikin function disini.

Terus set di routing. Apaan tuh routing? Nih “Routing how to get access to the URL mapped to the corresponding processing logic. The router calls mux.handler.ServeHTTP(w, r)when it receives requests. In other words, it calls ServeHTTPinterface of handlers. The router uses URL as a key to find corresponding handler that saved in map, and calls handler. ServeHTTP to execute functions to handle data. ”(translate sendiri atuh, hahah)








0 komentar:

Posting Komentar