GithubHelp home page GithubHelp logo

flow-2's Introduction

> flow

Dependency Status devDependency Status

> flow screenshot

Setup

Clone le repo:

git clone https://github.com/hhaidar/flow.git
cd flow

Get gulp:

npm install -g gulp

Party time:

npm start

Development

You can build assets by running gulp. They are served from client/build

Writing Services

Built-in services are located in server/lib/services/built-in. They consist of a contstructor and fetch method.

'use strict';

var Forecast = require('forecast');

function Provider(options) {

    this.options = options;

    this.client = new Forecast({
        service: options.source || 'forecast.io',
        key: options.key,
        units: 'celcius',
        cache: true,
        ttl: {
            minutes: 30
        }
    });

}

Provider.prototype.fetch = function(done) {
    this.client.get(this.options.location, function(err, data) {
        done(err, data);
    });
};

module.exports = Provider;

Task files

Services do not actually run on their own. You'll need to create a task file in /tasks that calls the service and passes it whatever options it needs (interval, api key, etc..)

Here's what a task file looks like:

id: weather-toronto # unique identifier used by the frontend
service: weather # this is the service name
interval: 30 minutes

# custom options passed into the service
location: [43.6482, -79.3887]
source: forecast.io
key: blahblah

Running tasks

You actually don't have to run the server to see what a service will fetch.

There's a handy command-line tool available and here's how to use it:

node manage.js run ./tasks/weather.yml
Running [weather-toronto]
{ summary: 'Partly Cloudy',
  icon: 'partly-cloudy-day',
  temperature: 23.62,
  timezone: 'America/Toronto' }

flow-2's People

Contributors

funkaoshi avatar hhaidar avatar

Watchers

 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.