Simple Golang Product API Server

Simple Golang Product API Server

Layanan API untuk menambah, merubah informasi, mengambil data dan menghapus produk. Implementasi kode terinspirasi oleh pola arsitektur hexagonal yang memisahkan proses manjadi beberapa domain.

Layanan API Server

  • Autentikasi user
  • CRUD produk dan foto produk

Inisialisasi API Server

Database yang digunakan PostgreSQL, ORM menggunakan pustaka gorm dan web framework menggunakan echo. Sebelum memulai pastikan file .env sudah disesuaikan dengan konfigurasi yang digunakan. Stuktur database sudah otomatis ter-migrasi ke database yang sudah diset di file .env . Untuk setiap kali request penambahan, perubahan informasi, pengambilan data dan penghapusan produk menggunakan autentikasi JWT dimana Token didapat dari proses login dan user untuk login didapat dari proses registrasi user.

Menjalankan API Server

  • Menggunakan Golang, cukup jalankan perintah ini di terminal tempat sources di simpan.

    go run .
  • Menggunakan Docker, pastikan anda sudah menginstall docker terlebih dahulu dan jalankan perintah dibawah ini. Docker akan mendownload image yang sudah dibuat dengan resource tersebut dan akan membuat container yang langsung siap untuk digunakan.

    • Membuat dan menjalankan container dibelakang layar

      docker-compose up -d

      API server secara default berjalan di: http://localhost:8000/v1

    • Menon-aktifkan daftar container

      docker-compose stop
    • Men-aktifkan daftar container

      docker-compose start
    • Menghapus daftar container

      docker-compose down
  • Build image docker, Anda juga dapat melakukan build image docker API server dengan menjalankan perintah diterminal pada source.

    docker build -t <
         
          > .
         

Melakukan pengujian API server

Untuk dokumentasi singkat penggunaan API server yang berkaitan dengan nama end point, parameter dan respon data dapat dilihat pada Postman-2021-10-28.json .

Kontak

Widya Ade Bagus - https://www.linkedin.com/in/widya-ade-bagus-3a660716b/

Owner
Widya Ade Bagus
Belajar untuk tekun belajar dan bertekat keras untuk konsisten
Widya Ade Bagus
Similar Resources

Simple HTTP server written in golang

Simple HTTP server written in golang Simple webserver in golang, to demonstrate basic functionalities like e.g. sending back some request header info,

Aug 31, 2022

Go-simplehttp - Simple HTTP server written in golang

Simple HTTP server written in golang Simple webserver in golang, to demonstrate

Jan 1, 2022

A simple SHOUTcast server.

DudelDu DudelDu is a simple audio/video streaming server using the SHOUTcast protocol. Features Supports various streaming clients: VLC, ServeStream,

Nov 20, 2022

KissLists is a very simple shared lists server

KissLists is a very simple shared lists server

KissLists is a very simple shared lists server. with mobile optimised design basic theme support websockets messages sqlite database but no

Nov 30, 2022

A simple HTTP Server to share files over WiFi via Qr Code

A simple HTTP Server to share files over WiFi via Qr Code

go-fileserver A simple HTTP server to share files over WiFi via QRCode Installation You can download compressed version from

Oct 8, 2022

Oogway is a simple web server with dynamic content generation and extendability in mind supporting a Git based workflow.

Oogway Oogway is a simple web server with dynamic content generation and extendability in mind supporting a Git based workflow. It's somewhere in betw

Nov 9, 2022

CasaOS - A simple, easy-to-use, elegant open-source home server system.

CasaOS - A simple, easy-to-use, elegant open-source home server system.

CasaOS - A simple, easy-to-use, elegant open-source home server system. CasaOS is an open-source home server system based on the Docker ecosystem and

Jan 8, 2023

A simple Go HTTP server that proxies RPC provider requests

go-rpc-provider-proxy A simple Go HTTP server that proxies RPC provider requests.

Nov 21, 2021

A simple file server written in Go. Allows files to be uploaded, downloaded, or deleted.

Go File Server This is a simple file server written in Go. Have you ever wanted to transfer files between computers on the same LAN? Simply run this p

Jan 14, 2022
a simple http server as replacement of python -m http.server

ser a simple http server as replacement of python -m http.server

Dec 5, 2022
Heart 💜A high performance Lua web server with a simple, powerful API
Heart 💜A high performance Lua web server with a simple, powerful API

Heart ?? A high performance Lua web server with a simple, powerful API. See the full documentation here. Overview Heart combines Go's fasthttp with Lu

Aug 31, 2022
A simple server with REST API to keep track of your TODOs (with html interface).
A simple server with REST API to keep track of your TODOs (with html interface).

TODOserver A simple server written in GO using gin and gorm. Getting started Download the repository docker build -t todoserver . docker run -p 8888:8

Nov 10, 2021
A simple http-web server logging incoming requests to stdout with simple http-interface.
A simple http-web server logging incoming requests to stdout with simple http-interface.

http-cli-echo-logger A simple http-web server logging incoming requests to stdout with simple http-interface. Run locally go run ./cmd/main.go Default

Jul 18, 2022
Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.
Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.

Teal.Finance/Server Opinionated boilerplate HTTP server with CORS, OPA, Prometheus, rate-limiter… for API and static website. Origin This library was

Nov 3, 2022
OpenAPI specs for your Go server, generated at server runtime. No CLI, no code generation, and no HTTP

Overview "oas" is short for "OpenAPI Spec". Go package for generating OpenAPI docs at runtime. Non-features: No code generation. No CLI. No magic comm

Dec 3, 2021
A Language Server Protocol (LSP) server for Jsonnet

Jsonnet Language Server A Language Server Protocol (LSP) server for Jsonnet. Features Jump to definition self-support.mp4 dollar-support.mp4 Error/War

Dec 14, 2022
Go web server - A web server that can accept a GET request and serve a response.

go_web_server A web server that can accept a GET request and serve a response. Go is a great language for creating simple yet efficient web servers an

Jan 3, 2022
A very simple Golang server handling basic GET and POST requests

GOLANG SERVER INTRO As a true Blockchain enthusiast, I had to learn Solidity and Golang to participate to several projects. This repository consists o

Nov 17, 2021