Skip to main content

Creating services

You will learn
  • How hyrule service create scaffolds a service
  • What it generates, and why it's a starting point, not a finished API
  • How what it generates relates to everything in Learn

Scaffold a service​

From the root of a project hyrule new created (it looks for a services/ directory, so this fails outside one):

hyrule service create articles

This writes services/articles/:

  • main.go — app.Main(spec()), the same bootstrap Your First Resource builds by hand.
  • resource.go — a setup function registering one rest.Resource named articles, with a minimal schema (one required name field) and behaviors/audit's hooks already wired in.
  • resource_test.go — one testkit-based test exercising a create and a get, the same pattern Testing walks through.

It's a starting point, not a finished resource​

What's generated is deliberately small: one field, two methods (GET/POST on the collection, GET/PATCH on an item), one behavior. From here, everything in Learn applies exactly as written — there's no Platform-specific resource format to learn on top of it:

hyrule service create only saves you the boilerplate of the first three files; what you build on top is the same framework, used the same way, whether or not the CLI wrote the first line.

Recap
  • hyrule service create <name> writes a minimal, working app.Main + rest.Resource + test — not a finished API.
  • Everything the Learn guide teaches about resources, hooks, relations and the outbox applies unchanged to a generated service.