troll

command module
v0.0.0-...-e5a5495 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: BSD-2-Clause Imports: 11 Imported by: 0

README

Troll

pipeline status coverage report
Go Report Card Latest Release

Troll is a very simple webserver returning defined response with configurable delay and a few more features.

Purpouse

  • Testing API endpoint (configurable via YAML).
  • Responding with random predefined delay.
  • Serve static files from FS.
  • Ready to use API backend for FE app prototyping.
  • Demo CI/CD with GOlang application

Features:

  • Define minimal wait interval for response
  • Define document root for serving static content
  • Aplication name could be defined
  • Listen port could be set via ENV
  • Print received json data to log and respond in json
  • Log with basic request_id

RUN

troll -help

  -name string
        Define custom application name (default "troll")
  -root string
        Define document root for serving files (default "./public")
  -wait int
        Minimal wait time before each request
      
  -v2-path string
        Path to the yaml with custom api definition, example format is in part custom API definition

Listen port

Application accept env PORT and the default value is :8080

Custom API definition

By editing v2_api.yaml you can change /v2 endpoints and his responses (return code including).

The default structure is:

---
name: Inventory
description: Our company inventory includes employees and equipment
version: 2022-02-09
endpoints:
- path: /employee
  method: GET
  code: 200
  response: "List of our employee..."

Documentation

Overview

Hello world web application (example)

Jump to

Keyboard shortcuts

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