https://github.com/rizkimufrizal/belajar-golang
https://github.com/rizkimufrizal/belajar-golang
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rizkimufrizal/belajar-golang
- Owner: RizkiMufrizal
- Created: 2022-10-06T13:05:48.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-08T09:17:32.000Z (over 2 years ago)
- Last Synced: 2025-01-08T02:13:40.359Z (5 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# belajar-golang
## Cara Menjakankan
1. Jalankan docker compose terlebih dahulu dengan perintah `docker-compose up`
2. Jalankan perintah `go mod download` untuk mendownload dependency yang dibutuhkan oleh project
3. Kemudian jalankan perintah `go run main.go` untuk menjalakan aplikasi## Akses REST API
### Get Employee
```shell
curl --location --request GET 'http://localhost:3000/api/employee'
```### Get One Employee
```shell
curl --location --request GET 'http://localhost:3000/api/employee/1'
```### Create Employee
```shell
curl --location --request POST 'http://localhost:3000/api/employee' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 1,
"name": "rudi",
"age": 10,
"address": "jakarta",
"level": "junior",
"salary": 1000
}'
```### Update Employee
```shell
curl --location --request PUT 'http://localhost:3000/api/employee' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 1,
"name": "rudi",
"age": 10,
"address": "depok",
"level": "junior",
"salary": 1000
}'
```### Delete Employee
```shell
curl --location --request DELETE 'http://localhost:3000/api/employee/1'
```