Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 5 days 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 (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T09:30:03.000Z (over 5 years ago)
- Last Synced: 2024-04-22T00:17:17.552Z (9 months ago)
- Topics: go, mongodb, rest-api
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 7
- Watchers: 3
- 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|