Coder Social home page Coder Social logo

basic-go's Introduction

Golang mini project

Project ini bertujuan untuk membuat sebuah program yang digunakan untuk menerima request dari port 80 (HTTP) dan memberikan response sesuai dengan response yang sudah dibuat.

Beberapa bagian penting dalam program ini adalah

  1. Library yang digunakan Aplikasi ini menggunakan beberapa library sebagai pendukung yaitu

    1. net/http : implementasi protokol http
    2. os : fungsionalitas operasi sistem
    3. echo : library untuk framework web golang
  2. Return ke http menggunakan echo untuk generate content

    e.GET("/", func(c echo.Context) error {
            return c.String(http.StatusOK, "Hello, World!\n")
    })
    
  3. Penentuan port yang digunakan oleh protokol http

    httpPort := os.Getenv("PORT")
    if httpPort == "" {
            httpPort = "80"
    }
    

Untuk menjalankan program berikut, kita gunakan environment dari docker secara langsung, berikut langkah-langkahnya

  1. Pastikan docker sudah terinstall dan sudah dijalankan di local

    docker system info
    
  2. Build image dari Dockerfile yang sudah ada

    docker build -t test-go:1 .
    
  3. Jalankan image hasil build dari Dockerfile sebelumnya

    docker run --rm -p 80:80 --name test-go test-go:1
    

Setup project

Dalam project ini juga ada dokumentasi terkait instalasi minikube pada opensuse, bisa klik link berikut Klik disini

basic-go's People

Contributors

ex-dec avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.