/student-api-go

Simple CRUD Student Restful API with Golang

Primary LanguageGo

Simple CRUD Student Restful API with Golang

Authentication

  • Api Key Header X-Api-Key = RAHASIA

Live Demo

link restful api

Schema Database

schema-database.png

API DOC

Student API Test.postman_environment.json

Students API.postman_collection.json

API Specification

apispec.json

Library

Command

  • go mod init antoniusbunwijaya/student-api-go
  • go get -u github.com/go-sql-driver/mysql
  • go get -u github.com/julienschmidt/httprouter
  • go get -u github.com/go-playground/validator
  • go install -tags 'mysql' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
  • migrate
  • migrate create -ext sql -dir db/migrations create_table_majors
  • migrate create -ext sql -dir db/migrations create_table_students
  • migrate create -ext sql -dir db/migrations create_table_hobbies
  • migrate create -ext sql -dir db/migrations create_table_student_hobbies
  • CREATE DATABASE student_api_go
  • migrate -database "mysql://root@tcp(localhost:3306)/student_api_go" -path db/migrations up