An open API service indexing awesome lists of open source software.

https://github.com/tkc/go-echo-server-sandbox

A scaffold of golang web server using labstack/echo
https://github.com/tkc/go-echo-server-sandbox

boilerplate echo golang gorm labstack-echo sandbox scaffold web-app webserver

Last synced: 11 months ago
JSON representation

A scaffold of golang web server using labstack/echo

Awesome Lists containing this project

README

          

![Go](https://github.com/tkc/go-echo-server-sandbox/workflows/Go/badge.svg)

# go-echo-server-sandbox

echo server sandbox using ORM mapper and html template.

- github.com/labstack/echo
- github.com/jinzhu/gorm
- github.com/pilu/fresh
- github actions

## Requirements

### Go

```
$ brew install goenv
$ goenv install 1.13.x
$ goenv global 1.13.x
$ goenv rehash
```

## Dependency

```sh
$ make dep
```

## Install golangci-lint

```
$ brew install golangci/tap/golangci-lint
$ brew upgrade golangci/tap/golangci-lint
```
[more...](https://github.com/golangci/golangci-lint#macos)

## Lint

```
$ golangci-lint run
```

## Database (MySQL) Config

`note: cp config.yaml.example config.yaml`

update database config

``` yaml
app: local
port: :8080

database:
name:
name:
password:
```

## Migration

``` sh
$ go run ./migrate/migrate.go
```

## Serve and Hot Reload

``` sh
$ fresh
```

## Create New User

``` sh
$ curl http://localhost:8080/user \
-X POST \
-H "Content-Type: application/json" \
-d '{"Name": "userName","Age": 1}'
```

## Testing

``` sh
$ go test ./...
```