Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drenther/go_service
https://github.com/drenther/go_service
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/drenther/go_service
- Owner: drenther
- Created: 2019-11-22T16:45:54.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-23T05:29:31.000Z (almost 5 years ago)
- Last Synced: 2024-06-19T04:27:11.826Z (5 months ago)
- Language: Go
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go_service
A mini golang webserver using echo
## Setup
- Install [golang](https://golang.org/dl/) from the official site
- `git clone` this repo
- cd into this repo
- then run `go get` to install all the dependencies
- then run `go build` to build the server
- now you will have a binary named `go_service` in the repo
- run this binary and your server should be up## API Endpoints
### POST /
Save a new task for the user
#### Headers
```json
{
"Content-Type": "application/json",
"Authorization": "Bearer userToken"
}
```#### Request Body
```json
{
"body": "Task content"
}
```### Response Body
```json
{
"id": "random_uuid_v4",
"user": "userToken",
"body": "Task Content"
}
```### GET /
Lists all the tasks for the user
#### Headers
```json
{
"Content-Type": "application/json",
"Authorization": "Bearer userToken"
}
```#### Response Body
```json
[
{
"id": "random_uuid_v4",
"user": "userToken",
"body": "Task Content"
}
]
```> NOTE: may return `204` HTTP STATUS CODE (no-content) if the database is empty, handle that in the frontend