shelf_hasura_actions 1.0.2 copy "shelf_hasura_actions: ^1.0.2" to clipboard
shelf_hasura_actions: ^1.0.2 copied to clipboard

Shelf Middleware for Hasura Action.

shelf_shelf_hasura_actions #

Shelf Middleware for Hasura Action. See Hasura Action Doc

Usage Action #

A simple usage example :

import 'package:shelf_hasura_actions/shelf_hasura_actions.dart';
import 'package:shelf/shelf_io.dart' as io;
import 'calculate_usebmi_function.dart' as bmi;

void main() async {
  //get handler
  final hasuraHandler = hasuraActions(_actions);

  // just put in shelf pipeline
  var server = await io.serve(hasuraHandler, 'localhost', 8080);
  print('Serving at http://${server.address.host}:${server.port}');
}


//my actions list
const _actions = <String, BindCallbackAction>{
  'bmiAction': bmi.calculateUseBmi,
};

Action Function example: #

import 'package:shelf_hasura_actions/src/hasura_request.dart';
import 'package:shelf/shelf.dart';

Future<Response> calculateUseBmi(ActionRequest action) async {
  return Response.ok('result": ok');
}

Usage Trigger #

A simple usage example :

import 'package:shelf_hasura_actions/shelf_hasura_actions.dart';
import 'package:shelf/shelf_io.dart' as io;
import 'calculate_usebmi_function.dart' as bmi;

void main() async {
  //get handler
  final hasuraHandler = hasuraTrigger(_actions);

  // just put in shelf pipeline
  var server = await io.serve(hasuraHandler, 'localhost', 8080);
  print('Serving at http://${server.address.host}:${server.port}');
}


//my actions list
const _actions = <String, BindCallbackTrigger>{
  'bmiAction': bmi.calculateUseBmi,
};

Trigger Function example: #

import 'package:shelf_hasura_actions/src/hasura_request.dart';
import 'package:shelf/shelf.dart';

Future<Response> calculateUseBmi(TriggerRequest action) async {
  return Response.ok('result": ok');
}

Features and bugs #

Please file feature requests and bugs at the [issue tracker][tracker].

5
likes
100
pub points
0%
popularity

Publisher

unverified uploader

Shelf Middleware for Hasura Action.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

meta, shelf

More

Packages that depend on shelf_hasura_actions