Giter VIP home page Giter VIP logo

openfaas-dart-template's Introduction

Dart Template for OpenFaaS

An OpenFaaS template for writing serverless functions in Dart.

Usage

First, fetch the template:

$ faas-cli template pull https://github.com/adaptant-labs/openfaas-dart-template
Fetch templates from repository: https://github.com/adaptant-labs/openfaas-dart-template at master
2019/09/17 00:57:59 Attempting to expand templates from https://github.com/adaptant-labs/openfaas-dart-template
2019/09/17 00:58:00 Fetched 1 template(s) : [dart] from https://github.com/adaptant-labs/openfaas-dart-template

Then begin a new project:

$ faas-cli new hellodart --lang dart

Make some modifications to hellodart/lib/handler.dart and hellodart/pubspec.yaml:

import 'dart:core';
import 'dart:io';

String Handle(String req) {
  final begin = DateTime.now();

  print("Hello from Dart! -- Invoked at: " + begin.toIso8601String());

  // Do some work
  sleep(Duration(milliseconds: 20));

  final elapsed = DateTime.now().difference(begin).inMilliseconds;

  print(elapsed.toString() + "ms elapsed");

  return req;
}

Build, deploy, and test:

$ faas-cli build -f hellodart.yml
$ faas-cli deploy -f hellodart.yml
$ echo | faas-cli invoke hellodart
Hello from Dart! -- Invoked at: 2019-09-16T23:15:04.095636
23ms elapsed

Features and bugs

Please file feature requests and bugs at the issue tracker.

License

Licensed under the terms of the MIT license, the main license under which the OpenFaaS project is licensed. For additional information, the full version of the license can be found in the LICENSE file included in this distribution.

Acknowledgements

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 825480.

openfaas-dart-template's People

Contributors

pmundt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.