https://github.com/kei178/go-mongo-api
REST API example with GO & MongoDB
https://github.com/kei178/go-mongo-api
go mongodb rest-api
Last synced: 8 months ago
JSON representation
REST API example with GO & MongoDB
- Host: GitHub
- URL: https://github.com/kei178/go-mongo-api
- Owner: kei178
- License: mit
- Created: 2019-07-02T20:36:59.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T09:30:03.000Z (over 6 years ago)
- Last Synced: 2025-05-07T20:02:45.377Z (11 months ago)
- Topics: go, mongodb, rest-api
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-mongo-api
REST API example with GO & MongoDB
## Requirements
- [Git](https://git-scm.com/)
- [Docker](https://www.docker.com/)
- [docker-compose](https://docs.docker.com/compose/)
## Running
```
docker-compose up
```
You can access the API server at `http://localhost:8080`.
If you change something, execute the following command, instead:
```
docker-compose up --build
```
## Shutdown
```
docker-compose down
```
## APIs
The entity Book has the following fields:
- ID (primitive.ObjectID)
- title (string)
- author (string)
Books APIs are as follows:
|METHOD|ENDPOINT|REQUEST HEADERS|REQUEST PAYLOAD|RESPONSE PAYLOAD|
|------|---|---------------|---------------|----------------|
|GET|/books| | |Book[]|
|POST|/books|Content-Type: "application/json"|Book|Create result|
|GET|/books/:id | | |Book|
|PUT|/books/:id |Content-Type: "application/json"|Book|Update result|
|DELETE|/books/:id | | |Delete result|