Explore projects
Gobeginnerbackend
REST API Mock Server
Mock server for REST APIs: define endpoints and responses in a YAML/JSON file, the server serves them instantly.
5 steps
Project steps
- 01
Config file
mocks.yaml: list of {method, path, status, body, headers, delay}.
- 02
Route registration
Parses the config and registers chi handlers for each entry.
- 03
Response templates
Bodies can contain placeholders: {{.ID}}, {{.RandomInt}}, {{.Now}}.
- 04
Request logging
Structured log per request: method, path, matched route, response time.
- 05
Hot reload
SIGHUP or filewatch: reloads config without server restart.
Recommended resources
Ready to build this?
Fork the repo on GitHub and start building. A mentor will review your code when you open a PR.
5 steps
Tech stack
Gochigopkg.in/yaml.v3encoding/json