https://github.com/4nth0/golem
From a single config file Golem start a mock server
https://github.com/4nth0/golem
api api-server mock qa qatools rest-api testing
Last synced: 2 months ago
JSON representation
From a single config file Golem start a mock server
- Host: GitHub
- URL: https://github.com/4nth0/golem
- Owner: 4nth0
- License: mit
- Created: 2020-02-27T19:36:02.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-02-06T15:56:48.000Z (about 1 year ago)
- Last Synced: 2025-02-06T16:41:42.712Z (about 1 year ago)
- Topics: api, api-server, mock, qa, qatools, rest-api, testing
- Language: Go
- Homepage:
- Size: 4.08 MB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Presentation
Golem is a tool that creates development servers from a config file.
Basically, you can create a static files server, a JSON database on the fly or routes based web server
## Getting started
> Golem is a draft, there no pre-compiled executables yet.
> To use it you have to build it from sources.
To start a new Golem server you have to create a config file named golem.yaml
This file should contain at least the following entries:
* __port:__ the main port used by the server
* __services:__ a list of one or more services mounted by Golem
Each service should contain:
* A name
* A type
* A configuration
There is an example of a server that's return a JSON object
```
port: "7171"
services:
- name: "Ping Server"
http_config:
routes:
"/ping":
body: '{"message": "pong!"}'
```
From this configuration file, Golem will start a server listening on the port `7171`
You also use parameters on the route declaration and retrieve them as template variables:
```
port: "7171"
services:
- name: "Move"
http_config:
routes:
"/ping":
body: '{"message": "pong!"}'
"/echo/:message":
handler:
type: "template"
template: "${message}"
```
As you can see, to serve a static response we can simply use the `body` attribute.
To use a template as response we have to use the `handler` attribute with two childs:
* __type:__ to specicy the handler type. `template` in this case
* __template:__ contains the template value