wharf-api

command module
v0.0.0-...-2a3db7f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 52 Imported by: 0

README

Wharf API

Codacy Badge

The API is one of the main components in Wharf. Its purpose is mainly a CRUD interface on top of the database that the other components in Wharf interact with.

Components

Configuring

The wharf-api program can be configured via environment variables and through optional config files. See the docs on the Config type over at: https://pkg.go.dev/github.com/iver-wharf/wharf-api#Config

Development

  1. Install Go 1.16 or later: https://golang.org/

  2. Install dependencies using GNU Make or GNUWin32

    $ make deps
    
  3. Generate the Swagger files (this has to be redone each time the swaggo documentation comments has been altered):

    $ make swag
    
  4. Start hacking with your favorite tool. For example VS Code, GoLand, Vim, Emacs, or whatnot.

Releasing

Replace the "v2.0.0" in make docker version=v2.0.0 with the new version. Full documentation can be found at Releasing a new version.

Below are just how to create the Docker images using GNU Make or GNUWin32:

$ make docker version=v2.0.0
STEP 1: FROM golang:1.16.5 AS build
STEP 2: WORKDIR /src
--> Using cache de3476fd68836750f453d9d4e7b592549fa924c14e68c9b80069881de8aacc9b
--> de3476fd688
STEP 3: ENV GO111MODULE=on
--> Using cache 4f47a95d0642dcaf5525ee1f19113f97911b1254889c5f2ce29eb6f034bd550b
--> 4f47a95d064
STEP 4: RUN go get -u github.com/swaggo/swag/cmd/swag@v1.7.0
...

Push the image by running:
docker push quay.io/iver-wharf/wharf-api:latest
docker push quay.io/iver-wharf/wharf-api:v2.0.0

Linting Golang

go get -u github.com/mgechev/revive
npm run lint-go

Linting markdown

npm install

npm run lint-md

# Some errors can be fixed automatically. Keep in mind that this updates the
# files in place.
npm run lint-md-fix

Linting

You can lint all of the above at the same time by running:

npm run lint

# Some errors can be fixed automatically. Keep in mind that this updates the
# files in place.
npm run lint-fix

Maintained by Iver. Licensed under the MIT license.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
coalesce
Package coalesce helps with a simple use case: defining fallback values, similar to the null coalescing operator in languages such as C# and TypeScript, or the COALESCE function in SQL.
Package coalesce helps with a simple use case: defining fallback values, similar to the null coalescing operator in languages such as C# and TypeScript, or the COALESCE function in SQL.
set
pkg
model/database
Package database contains plain old Go types used by GORM as database models with GORM-specific Go tags.
Package database contains plain old Go types used by GORM as database models with GORM-specific Go tags.
model/request
Package request contains plain old Go types used in the Gin endpoint handlers and Swaggo documentation for the HTTP request models, with Gin- and Swaggo-specific Go tags.
Package request contains plain old Go types used in the Gin endpoint handlers and Swaggo documentation for the HTTP request models, with Gin- and Swaggo-specific Go tags.
model/response
Package response contains plain old Go types returned by wharf-web in the HTTP responses, with Swaggo-specific Go tags.
Package response contains plain old Go types returned by wharf-web in the HTTP responses, with Swaggo-specific Go tags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL