Route wiring
Generated files carry fixed marker comments that later CLI invocations anchor on to insert new code without reparsing Go — so re-running nexler create <route> against an already-scaffolded route only ever adds what's missing.
| Marker | Where | What gets inserted there |
|---|---|---|
| // nexler:routes | routes/public(or protected)/*.go | New route imports and Register(mux) calls. |
| // nexler:handlers | handlers/.../<file>.go (one or more per package) | New per-method handler functions when adding -methods to an already-scaffolded -file. |
| // nexler:register | handlers/.../<file>.go (one per resource — usually exactly one per package, or more with -own-register) | New mux.HandleFunc/openapi.Register calls, for every method regardless of which file its handler is defined in. |
| // nexler:models | models/.../<file>.go (one or more per package) | New Request/Response struct pairs. |
If a marker is missing (e.g. a route scaffolded before this feature existed, or a hand-edited file), the insert fails with an error naming the exact marker text to add back by hand — it never silently guesses a location.
A package's handler/model code can span more than one file.
-file names the specific handler/model file this invocation targets: if it already exists, new methods are appended to it; if it doesn't, a genuine new file pair is created for them (with no Register func of its own, since Go permits only one per package). Either way, registration wiring lands in the package's existing primary file — unless -own-register is passed, in which case the new file becomes its own independent primary with its own distinctly-named Register<name> function instead (see create <route>).Adding a second, distinct route to an already-scaffolded package (same
-module/-submodule, different path, overlapping verb) is checked for handler/type/OperationID collisions across every file in the package before anything is written — since identifiers are derived from -module/-submodule + verb, not the URL path, two different routes sharing those would otherwise generate duplicate/colliding code. Pass -name to give the new route distinct identifiers (this also disambiguates its HTML content file, for -response html routes).