api.yaml
All endpoints are defined in api.yaml. Edit it directly or add via gofire add endpoint.
Example api.yaml
version: "1"
basePath: /api
endpoints:
- method: GET
path: /api
handler: Health
auth: false
- method: GET
path: /api/health
handler: Health
auth: false
- method: GET
path: /users
handler: ListUsers
auth: true
- method: POST
path: /users
handler: CreateUsers
auth: true
- method: GET
path: /users/:id
handler: GetUsersById
auth: true
Fields
auth: true– Route is protected by Firebase Auth middlewareauth: false– Route is publichandler– Function name generated inhandlers/directory
Output paths
Use the optional output section when your project uses a different layout (e.g. pkg/server, pkg/handler). You can put it in api.yaml or in .gofire.yaml at project root:
output:
serverDir: pkg/server
handlersDir: pkg/handler
Resolution: CLI flags > .gofire.yaml > api.yaml output > default. Then gofire gen uses these paths without flags.
After api.yaml changes
After editing api.yaml or running gofire add endpoint, run:
gofire gen
The server loads api.yaml at startup, so new endpoints work after generating handlers only. No need to regenerate the server for new routes. Use gofire gen --handlers-only if you have a custom server.