Sign inSign up

mrsiregar/godbapp

By mrsiregar

•Updated over 8 years ago

This image created with "automated builds".

Image
0

173

mrsiregar/godbapp repository overview

⁠Godbapp

With golang and mongo image, this compose will build dummy counters and simple rest api service for storing user data. Next, i'll find a way to save shopping cart data. Add and remove item from nested array.

type Users struct {
	Id bson.ObjectId `bson:"_id,omitempty" json:"id"`
	Nama string `bson:"nama" json:"nama"`
	Kota string `bson:"kota" json:"kota"`
	//Keranjang []Keranjang `bson:"keranjang" json:"keranjang"`
}

Http method implementation :

r.HandleFunc("/api/counter", api.CheckCounter).Methods("GET")
r.HandleFunc("/api/users", api.CreateUser).Methods("POST")
r.HandleFunc("/api/users/{id}", api.GetUser).Methods("GET")
r.HandleFunc("/api/users/{id}", api.DeleteUser).Methods("DELETE")
r.HandleFunc("/api/users", api.GetAllUser).Methods("GET")

How to run this code?

~ docker-compose build
~ docker-compose up -d

Check the counter

alt text

Create new user

alt text

Get user by id

alt text

Delete user

alt text

Tag summary

Content type

Image

Digest

Size

269.9 MB

Last updated

over 8 years ago

docker pull mrsiregar/godbapp