golang-chi-rest-db-oauth-sample
REST sample with all the stuff we need in our day jobs
- REST with documentation
- JWT with central IDP
- DB migrations on postgres
- external configuration with TOML
Setup
- install Go 1.7
- get sources
$ go get github.com/adorsys/golang-chi-rest-db-oauth-sample
- start DB:
$ docker-compose up
(localhost:5432) - start service:
$ go run main.go --conf data/conf/dev.toml
- [get JWT](https://buildrunclick.eu.auth0.com/login?client=0beCklFKuabEpbQ2SJ34m6JmwxYDsn5H&protocol=oauth2&redirect_uri=https://adorsys.de/karriere.html&response_type=token&scope=openid roles) ([email protected]:admin)
- copy token from URL after redirect
- try with curl:
curl --request GET \
--url http://localhost:3333/articles \
--header 'accept: application/json' \
--header 'authorization: Bearer $JWT'
- generate route markdown docs:
go run main.go --routes