This is the backend API behind placeholder.app. See the frontend repository here
Sizes supported are 30px thru 4000px. These are just example sizes with default options.
git clone https://github.com/placeholder-app/backendcd backend/go installTo build all binaries from the source
make buildTo build a specific binary
make build_[platform]Platforms: linux, mac, freebsd, windows
All of the above commands output to the /bin folder by default. To run the application, simply execute the build
./bin/[platform]To clean the workspace
make cleanIf you choose to run without compiling, you can refer to this section.
Run with default options (For local testing)
go run main.goRun with configuration (See main.go for options)
PORT=80 go run main.goRun with SSL
SSLCERT=./cert.pem SSLKEY=./key.pem PORT=443 go run main.goNote: On Linux, you may need to run go as sudo for ports 80 or 443
The included makefile provides options to run golang test cases, and to build the openapi documentation.
To run the included Golang unit tests, with coverage,
make testsNote: This will not output any files. See the commandline output
The OpenAPI (swagger) file is in .vscode/openapi.yml.
To build the HTML documentation file (found on docs.placeholder.app), see below.
make docsAlternatively, you can run the command directly
openapi-generator-cli generate --skip-validate-spec -i ./.vscode/openapi.yml -g html2 -o ./docsBoth of the above commands output the HTML documentation inside ./docs
If you use VisualStudio Code, the ThunderClient request repository is available in .vscode/thunder-tests.
You can simulate requests to the API, or run HTTP-based testing.
- Go 1.19 (Minimum)
- gin-gonic/gin
- openapi-generator-cli (For documentation only)
Loosely built from ninjawerk/go-rest-boilerplate.