Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

5 total results found

Introduction

GDSC Sep 19th TOTP Authentication

1. Basic Application Architecture การทำ web application แบบเบื้องต้นจะมีภาพรวมเป็นประมาณนี้ครับ แต่หากเรามองให้ลึกลงไปจะเจอกับงานมากมายที่ต้องทำเพื่อให้เป็น application ขึ้นมาหนึ่งตัว งั้นก่อนอื่นเรามาดูระบบที่เรากำลังจะสร้างก่อนครับว่ามีอะไรบ้างที่เราต้อ...

Handle HTTP request with Golang

GDSC Sep 19th TOTP Authentication

เรามาเริ่มจากการเขียน handle HTTP สัก 1 endpoint ง่าย ๆ กันดีกว่า เพื่อเป็นตัวอย่างก่อนจะเริ่มทำเป็น Hexagonal Architecture เริ่มด้วยการ init project กันก่อนเลย สร้าง folder สำหรับ project นี้ก่อน สร้าง file main.go ขึ้นมา run command $ go mod init githu...

Implementing Hexagonal Architecture

GDSC Sep 19th TOTP Authentication

ส่วนนี้จะไม่มีการเขียน logic เพื่อให้ section นี้ไม่ยาวจนเกินไป ก่อนที่จะเปลี่ยน Architecture ที่ทำใน HTTP handle ในบทความก่อนไปเป็น Hexagonal Architecture เราต้องสร้างหลาย ๆ อย่างทำให้โค้ด base เปลี่ยนค่อนข้างเยอะ แต่ก็จะขอให้ค่อย ๆ ทำไปในความเร็วของตัวเองคร...

Create your configuration file for your project

GDSC Sep 19th TOTP Authentication

จาก section ก่อนหน้าจะสังเกตได้ว่าตอนนี้เรากำลังเชื่อม database ผ่าน connection string โดยเขียนไปในโค้ดโดยตรง ซึ่งถือเป็นสิ่งที่ไม่ควรทำครับ และสิ่งที่จะมาช่วยในส่วนนั้นก็คือการทำไฟล์เก็บ config หรือ token ต่าง ๆ ที่เราไม่ต้องการให้ผู้อื่นเห็นครับ เวลาเราอัพโห...

Implementing Authentication Logic

GDSC Sep 19th TOTP Authentication

เนื่องจากเรามี 3 ส่วนที่ต้อง implement เดี๋ยวจะเรื่มจากชั้นที่อยู่นอกสุดนะครับ ก่อนจะมา handle function ต่าง ๆ ส่วนมากผมจะทำ function utils ต่าง ๆ เพื่อมาช่วยในการ dev ก่อน และ 1 function สำคัญที่ขาดไม่ได้เลย ก็คือ bodyparser และเราจะไม่ลง lib ที่ไหนครับ เพรา...