Skip to main content

Create MVC Pattern Using Echo Framework #GolangDev

Hi, Back again. today I am gonna share about Go Language, yes it is a new programming language that really fast growing this day, so many startup using it, especially in indonesia, there is a Gojek, Dana, Tiket and many more. Go Lang is a programming language found by google engineer, this language is a multi paradigm language, you could use it as functional programming or treat it like an OOP bases.

Echo is an framework that use Golang as a main language, to use a fast and reliable backend/web apps, as you know Golang has a really fast performance than other language, one of the reason is because its compiled not interpreted, so the Echo claim that its 10x faster. insane right ? Actually I didn't test the performance yet, but yeah for newbie like me in golang its not the main thing that you must understand, so the thing that we should know is how we actually can do with Golang. 

I am person with MVC bases, before jump to golang, I have experience with Laravel, you know its typically MVC pattern bases, so to make me comfortable with new environment, I try to treat Golang to be a MVC bases to make a web apps. Hence Golang could do the seem thing without overwhelming to built as MVC.

Firstly install the Echo Framework using go get command, look at the documentation here.

I am using Echo because this framework is already present a router, controller, view unfortunately not the model, so if you need a models, I recomend you to use Gorm. Gorm is a package to manage a model and migration, you could define table and relation in one file model, just like a ORM do. if you dont know ORM, maybe this article will help you. another best thing is Gorm could be your migration too, so you could define a table and column name in the model, and apply the migration from the seem file. it's really good approach and applied DRY principal.

If you already have gorm installed, now you could create fundamental MVC folder structure to grouping the Models, Controller, and Views files.

Because I am people who really like the laravel structure folder, so I put any folder from laravel that I think it might be required. then the structure just link this.

If you know Laravel or Ruby on Rails, you might be familiar.

see the complete code here. Happy coding ^_^

Popular posts from this blog


Hai semua…. Saya kembali lagi untuk memberi tips dan trik computer untuk kalian. Pernahkah kalian kehabisan tinta?.Apalagi tinta hitam yang sring di gunakan buat print tugas!. Yah gitulah kalau dompet kempes tapi mau print tugas yang di kumpulin besok, wah mau print di warnet tapi gak punya duit, apalagi beli tinta waaaahhh. Tambah pusing..!!! Tapi jangan khawatir disini saya akan mengulas masalah tersebut dan memberi kalian jalan keluar untuk kalian yang dompetnya lagi kosong melompong kayak punya saya. Hehehe (jangan terseinggung ya, Cuma bercanda) Berikut adalah trik saya untuk print pada printer canon, tapi jangan khawatir kemungkinan besar gak beda jauh koq sama printer merk lain, tapi berbahagialah bagi yang printernya canon. Trik ini memiliki syarat kalau tinta warna harus ADA!! Ingat karna kita disini akan memodifikasi warna bukan menyulap catridge warna hitam yang semula habis menjadi full. LOL :D Nah sudah cukup basa basinya dengan saya berikut tutorialnya :  Buka document ya…

How Strict is Golang? #GolangDev

Hello everyone, in this occasion I would like to share about the strictness of golang. what kind of strict? let see below.

Golang is the functional programming that really have concern about performance, giving limitation to prevent overuse memory is the big deal. for example, golang has a variative type of data such as int, string, boolean, float, array etc. I wonder that you are thinking about "what kind of strictness that is? its totally similar other language", YES. but golang have specification in numeric type of data such as int have int8, int16, int32, int64. golang also have uint8, uint8, uint32 and uint64 which is its really strict you know. the following number after type of data is stand for the length. Obviously you could use the largest type of data for all the variables, but you know it could overwhelming if you put int64 in "is_valid" variable right? joking :D. golang really care about performance, because each length of variable is matters for memo…

Making a Segue Between Storyboard Part II #IOSDev

Hello everyone, in this tutorial i would like to continue my last tutorial about segue, if you dont have read it yet, just go to this link.

in this tutorial i would like to show you how to switch between view controller using programmatically in swift. interesting right? so here it is.
* create new project
* know how to put segue by drag and drop

firstly, open last xcode project about segue in the first tutorial. and then add new viewcontroller. like bellow

connect segue from first viewcontroller to third viewcontroller by dragging first viewcontroller icon and drop it to third viewcontroller, you could use ctrl+click to drag and drop. after you drop, you will face new popup window, choose "show" like bellow 

click on the segue path link like bellow

on the right side bar, you will see some menu, choose the attribute menu. and then you can see identifier option right there. fill the identifier as you want, in this tutorial we put "seguePartII" as the n…