Skip to main content
Version: v2.x

Hasura CLI: hasura actions create

Create a Hasura Action.

Synopsis

This command allows you to create an Action to extend Hasura's schema with custom business logic using queries and mutations. Optional flags can be used to derive the Action from an existing GraphQL query or mutation. Additionally, codegen can be bundled with the creation of the Action to provide you ready-to-use boilerplate with your framework of choice.

Further Reading:

hasura actions create [action-name] [flags]

Examples

# Create a Hasura Action
hasura actions create [action-name]

# Create a Hasura Action with codegen
hasura actions create [action-name] --with-codegen

# Create a Hasura Action by deriving from a Hasura operation
hasura actions create [action-name] --derive-from ''

# Create a Hasura Action with a different kind or webhook
hasura actions create [action-name] --kind [synchronous|asynchronous] --webhook [http://localhost:3000]

Options

    --derive-from string   derive action from a Hasura operation
-h, --help help for create
--kind string kind to use in Action (env "HASURA_GRAPHQL_ACTIONS_KIND")
--webhook string webhook to use in Action (env "HASURA_GRAPHQL_ACTIONS_HANDLER_WEBHOOK_BASEURL")
--with-codegen create Action along with codegen

Options inherited from parent commands

--admin-secret string            admin secret for Hasura GraphQL Engine (env "HASURA_GRAPHQL_ADMIN_SECRET")
--certificate-authority string path to a cert file for the certificate authority (env "HASURA_GRAPHQL_CERTIFICATE_AUTHORITY")
--endpoint string http(s) endpoint for Hasura GraphQL Engine (env "HASURA_GRAPHQL_ENDPOINT")
--envfile string .env filename to load ENV vars from (default ".env")
--insecure-skip-tls-verify skip TLS verification and disable cert checking (default: false) (env "HASURA_GRAPHQL_INSECURE_SKIP_TLS_VERIFY")
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
--no-color do not colorize output (default: false)
--project string directory where commands are executed (default: current dir)
--skip-update-check skip automatic update check on command execution

SEE ALSO

Auto generated by spf13/cobra