golang
-
[golang] Pointer(포인터)를 쓰는 이유프로그래밍/golang 2021. 12. 29. 16:31
golang에서의 Pointer먼저 golang의 컴파일러에 대한 내용을 중심으로 이해를 하고 넘어가야한다.설명에 도움이 되는 좋은 문서가 있어 공유하고자 한다.https://jacking75.github.io/go_stackheap/ golang - 스택과 힙에 대해 - jacking75실행 시 동적으로 메모리를 확보하는 영역으로서 스택과 힙이 있다. 스택 메모리는 함수 호출 스택을 저장하고 로컬 변수, 인수, 반환 값도 여기에 둔다. 스택의 Push와 Pop은 고속이므로 객체를jacking75.github.io 1. 포인터 기본포인터는 타입이다. 대신 포인터가 가리키는 변수의 메모리 주소를 갖는다. 즉 포인터 변수를 통해 다른 변수의 메모리 주소를 참조해 무언가 가능할 것 같은 느낌이다. golang..
-
공공데이터를 활용한 의약품 검색 사이트 구축 #1 백엔드 with Golang미니프로젝트 2021. 12. 27. 18:28
공공데이터를 활용한 의약품 검색 사이트 구축1. 프로젝트 구성이번 의약품 검색 사이트 구축 프로젝트에 사용될 구성이다.- 백엔드(golang)- 프론트엔드(vue.js)- 배포서버(AWS EC2) 백엔드에서 공공데이터 API를 요청하여 가공한 후 프론트엔드에서 백엔드를 통해 데이터를 확인할 수 있는 방식으로 설계를 할 것이다.2. 백엔드 개발환경[개발환경]OS : Ubuntu 21.10LANGUAGE : Golang 1.17.1 linux/amd64Framework : Echo Web FrameworkIDE : Visual Studio Code이번 프로젝트에서는 공공데이터를 가공하고 반환하는 Rest API 형태로 구축할 것이므로 Golang의 경량 웹 프레임 워크인 Echo를 사용할 것이다. Echo에..
-
[golang] JWT 인증 구현 (feat. 유저등록기능, 로그인기능)프로그래밍/golang 2021. 12. 22. 13:06
개발환경OS : Ubuntu 21.10Language : Golang 1.17 with Echo(Go web framework)IDE : Visual Studio CodeDB : MariaDB 10.5.13목차프로젝트 폴더 생성 및 사전 준비DB 커넥션 설정 및 회원가입 로그인 테스트JWT 발급 및 인증 구현마무리1. 프로젝트 폴더 생성 및 사전 준비워크스페이스로 사용할 폴더 하위에 이번 프로젝트로 사용할 폴더를 생성한다.mkdir test-jwttest-jwt 폴더로 이동한 후에 이번 프로젝트의 시작점이 될 main.go 파일을 생성하고 아래 내용을 입력한다.// main.gopackage mainimport "fmt"func main() { fmt.Println("Hello World!")}코드..