https://github.com/adorsys/golang-chi-rest-db-oauth-sample
REST sample with all the stuff we use
https://github.com/adorsys/golang-chi-rest-db-oauth-sample
Last synced: 6 months ago
JSON representation
REST sample with all the stuff we use
- Host: GitHub
- URL: https://github.com/adorsys/golang-chi-rest-db-oauth-sample
- Owner: adorsys
- License: apache-2.0
- Created: 2017-01-29T20:08:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-07T08:50:28.000Z (over 8 years ago)
- Last Synced: 2024-04-14T12:53:54.727Z (over 1 year ago)
- Language: Go
- Size: 185 KB
- Stars: 14
- Watchers: 8
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/adorsys/golang-chi-rest-db-oauth-sample)
# golang-chi-rest-db-oauth-sample
REST sample with all the stuff we need in our day jobs- [REST](https://github.com/pressly/chi) with documentation
- [JWT](https://github.com/goware/jwtauth) with [central IDP](https://auth0.com)
- [DB migrations](https://github.com/mattes/migrate) on [postgres](https://github.com/lib/pq)
- [external configuration with TOML](https://github.com/BurntSushi/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) (admin@buildrun.click:admin)
- copy token from URL after redirect
- try with curl:
```bash
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`