hashdo-web
Expose #Do functionality through a web API.
Last updated 2 years ago by hashdo .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hashdo-web 
SYNC missed versions from official npm registry.

#Do Web

Expose #Do functionality through a web API.

Getting Started

Step 1

Install #Do into your project using NPM.

npm install hashdo-web --save

Step 2

Require it in your code.

var hdweb = require('hashdo-web');

Step 3

Setup any plugins you may want to use

// Use MongoDB instead of default in-memory development database.
hdweb.hashdo.db = require('hashdo-db-mongo');

Step 4

Initialise the web server.

var baseUrl = 'https://myawesomesite.com';
var firebaseUrl = 'https://myawesomesite.firebaseio.com';
var port = 8080;
var cardsDir = './node_modules';

hdweb.init(baseUrl, firebaseUrl, port, cardsDir);

Step 5

Setup your own routes and/or middleware.

hdweb.express.get('/', function (req, res) {
  res.redirect('http://myawesomesite.com');
});

Step 6

Start the web server.

hdweb.start(function () {
  console.log('#Do web server is ready to go!');
});

Routes

The following routes are created to access #Do functionality through HTTP calls.

API

GET /api/count

Retrieve the number of cards that have been loaded in JSON format.

GET /api/cards?q=&page=

Retrieve the details for cards that have been loaded in JSON format. Parameter q can be used to provide a filter for card names. Parameter page will return the list of card on the requested page number. A maximum of 20 cards will be displayed per page.

GET /api/card?pack=&card=

Retrieve the details for a specific card. Parameter pack refers to the pack name the card belongs to. Parameter card is the card name.

POST /api/card/state/save

Allows saving card state directly from the client. This is called from client code using card.state.save which is available when clientStateSupport is enabled for your card.

POST /api/card/analytics

Allows sending analytics data directly from the client. This is called from client code using card.analytics.record which is available when clientAnalyticsSupport is enabled for your card.

Web Hook

POST /webhook/:pack/:card

Can be called to update a card's state from an external system. The body data must be JSON and will be passed into your card's webHook function for processing.

Cards

POST /:pack/:card

Secures any body data (secure card inputs) and responds with a token that can be used to decrypt that data. The body data must be JSON and will typically be any card inputs that need to be protected.

GET /:pack/:card

Gets card HTML (including inline JavaScript and CSS) for a specific card. URL query parameters are used for card inputs. token can be used to pass in any secured inputs.

License

Copyright 2015 (c). All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Current Tags

  • 0.1.94                                ...           latest (2 years ago)

95 Versions

  • 0.1.94                                ...           2 years ago
  • 0.1.93                                ...           2 years ago
  • 0.1.92                                ...           3 years ago
  • 0.1.91                                ...           3 years ago
  • 0.1.90                                ...           3 years ago
  • 0.1.89                                ...           3 years ago
  • 0.1.88                                ...           3 years ago
  • 0.1.87                                ...           3 years ago
  • 0.1.86                                ...           3 years ago
  • 0.1.85                                ...           3 years ago
  • 0.1.84                                ...           4 years ago
  • 0.1.83                                ...           4 years ago
  • 0.1.82                                ...           4 years ago
  • 0.1.81                                ...           4 years ago
  • 0.1.80                                ...           4 years ago
  • 0.1.79                                ...           4 years ago
  • 0.1.78                                ...           4 years ago
  • 0.1.77                                ...           4 years ago
  • 0.1.76                                ...           4 years ago
  • 0.1.75                                ...           4 years ago
  • 0.1.74                                ...           4 years ago
  • 0.1.73                                ...           4 years ago
  • 0.1.72                                ...           4 years ago
  • 0.1.71                                ...           4 years ago
  • 0.1.70                                ...           4 years ago
  • 0.1.69                                ...           4 years ago
  • 0.1.68                                ...           4 years ago
  • 0.1.67                                ...           4 years ago
  • 0.1.66                                ...           4 years ago
  • 0.1.65                                ...           4 years ago
  • 0.1.64                                ...           4 years ago
  • 0.1.63                                ...           4 years ago
  • 0.1.62                                ...           4 years ago
  • 0.1.61                                ...           4 years ago
  • 0.1.60                                ...           4 years ago
  • 0.1.59                                ...           4 years ago
  • 0.1.58                                ...           4 years ago
  • 0.1.57                                ...           4 years ago
  • 0.1.56                                ...           4 years ago
  • 0.1.55                                ...           4 years ago
  • 0.1.54                                ...           4 years ago
  • 0.1.53                                ...           4 years ago
  • 0.1.52                                ...           4 years ago
  • 0.1.51                                ...           4 years ago
  • 0.1.50                                ...           4 years ago
  • 0.1.49                                ...           4 years ago
  • 0.1.48                                ...           4 years ago
  • 0.1.47                                ...           4 years ago
  • 0.1.46                                ...           4 years ago
  • 0.1.45                                ...           4 years ago
  • 0.1.44                                ...           4 years ago
  • 0.1.43                                ...           4 years ago
  • 0.1.42                                ...           4 years ago
  • 0.1.41                                ...           4 years ago
  • 0.1.40                                ...           4 years ago
  • 0.1.39                                ...           4 years ago
  • 0.1.38                                ...           4 years ago
  • 0.1.37                                ...           4 years ago
  • 0.1.36                                ...           4 years ago
  • 0.1.35                                ...           4 years ago
  • 0.1.34                                ...           4 years ago
  • 0.1.33                                ...           4 years ago
  • 0.1.32                                ...           4 years ago
  • 0.1.31                                ...           4 years ago
  • 0.1.30                                ...           4 years ago
  • 0.1.29                                ...           4 years ago
  • 0.1.28                                ...           4 years ago
  • 0.1.27                                ...           4 years ago
  • 0.1.26                                ...           5 years ago
  • 0.1.25                                ...           5 years ago
  • 0.1.24                                ...           5 years ago
  • 0.1.23                                ...           5 years ago
  • 0.1.22                                ...           5 years ago
  • 0.1.21                                ...           5 years ago
  • 0.1.20                                ...           5 years ago
  • 0.1.19                                ...           5 years ago
  • 0.1.18                                ...           5 years ago
  • 0.1.17                                ...           5 years ago
  • 0.1.16                                ...           5 years ago
  • 0.1.15                                ...           5 years ago
  • 0.1.14                                ...           5 years ago
  • 0.1.13                                ...           5 years ago
  • 0.1.12                                ...           5 years ago
  • 0.1.11                                ...           5 years ago
  • 0.1.10                                ...           5 years ago
  • 0.1.9                                ...           5 years ago
  • 0.1.8                                ...           5 years ago
  • 0.1.7                                ...           5 years ago
  • 0.1.6                                ...           5 years ago
  • 0.1.5                                ...           5 years ago
  • 0.1.4                                ...           5 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (11)
Dev Dependencies (10)

Copyright 2014 - 2016 © taobao.org |