Simple Account Service in Golang
138
Simple Account Service in Golang
https://godoc.org/github.com/emj365/go-simple-account-service
go get github.com/emj365/go-simple-account-service
brew install dep
dep ensure
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
go run main.go
cp .env.sample .env
docker build -t go-simple-account-service:latest .
docker run \
-p 8000:8000 \
-v $(pwd)/.env:/root/.env \
go-simple-account-service:latest
→ curl localhost:8000/users -v -d '{"name":"mike", "password":"passwd"}'
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8000 (#0)
> POST /users HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Length: 36
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 36 out of 36 bytes
< HTTP/1.1 201 Created
< Content-Type: application/json
< Date: Tue, 11 Dec 2018 10:46:46 GMT
< Content-Length: 159
<
{"id":18,"created_at":"2018-12-11T18:46:46.482784+08:00","updated_at":"2018-12-11T18:46:46.482784+08:00","deleted_at":null,"name":"mike","password":"*******"}
* Connection #0 to host localhost left intact
→ curl localhost:8000/auth -v -d '{"name":"mike", "password":"passwd"}'
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8000 (#0)
> POST /auth HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Length: 36
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 36 out of 36 bytes
< HTTP/1.1 200 OK
< Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NDQ1Mjg4NzAsInN1YiI6IjE4In0.ETwBxo08XiC6ygMN_OrxiCXd79sxIevwXSYwVxMpqc8
< Content-Type: application/json
< Date: Tue, 11 Dec 2018 10:47:50 GMT
< Content-Length: 131
<
{"jwt":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NDQ1Mjg4NzAsInN1YiI6IjE4In0.ETwBxo08XiC6ygMN_OrxiCXd79sxIevwXSYwVxMpqc8"}
* Connection #0 to host localhost left intact
Content type
Image
Digest
Size
8.3 MB
Last updated
almost 8 years ago
docker pull emj365/go-simple-account-service