https://github.com/pytorchtw/go-json-rest-starter
https://github.com/pytorchtw/go-json-rest-starter
demo docker golang json rest starter
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pytorchtw/go-json-rest-starter
- Owner: pytorchtw
- Created: 2020-02-21T07:37:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-21T07:58:20.000Z (over 6 years ago)
- Last Synced: 2024-06-20T12:44:35.681Z (about 2 years ago)
- Topics: demo, docker, golang, json, rest, starter
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-json-rest-starter
#### This is a simple demo json rest server in golang with code adapted from https://github.com/ant0ine/go-json-rest
Installation
- Git clone to local directory
- Build, test and start up the service with docker compose
```
docker-compose up
```
- Open a new console and test with the following:
```
curl -i -H 'Content-Type: application/json' \
-d '{"Code":"FR","Name":"France"}' http://127.0.0.1:8080/countries
curl -i -H 'Content-Type: application/json' \
-d '{"Code":"US","Name":"United States"}' http://127.0.0.1:8080/countries
curl -i http://127.0.0.1:8080/countries/FR
curl -i http://127.0.0.1:8080/countries/US
curl -i http://127.0.0.1:8080/countries
curl -i -X DELETE http://127.0.0.1:8080/countries/FR
curl -i http://127.0.0.1:8080/countries
curl -i -X DELETE http://127.0.0.1:8080/countries/US
curl -i http://127.0.0.1:8080/countries
```
You should be able the see the incoming requests in the docker console