Giter Club home page Giter Club logo

ayah.js's Introduction

Are you a Human - node.js binding

How to use it

Install the module with npm:

npm install ayah

Include in your project:

var ayah = require('ayah');

Decorate your form with the PlayThru code:

var form = "<form>" + ayah.getPublisherHTML() + /* add more form elements + */ "</form>";

Verify the game result:

/* this can be within request.on('end', function () {…}) */
var parsed = querystring.parse(buf); // buf starts with "" and gets filled during 'data' requests
ayah.getScore(buf.session_secret, function (error, result) {
    if (error) {
        response.setHeader('Content-Type', 'text/plain');
        response.statusCode = 500;
        response.write('' + error);
    } else {
        response.setHeader('Content-Type', 'text/html');
        response.write('<html><body><p>Your call was a success</p><pre>' + JSON.stringify(result) + '</pre>' + ayah.recordConversion() + '</html>');
    }
    response.end();
});

For a full example, see examples/server.js.

ayah.js's People

Contributors

cluepunk avatar

Stargazers

marco avatar  avatar  avatar John Fonte avatar Steffen Persch avatar  avatar Shizuru Tashiro avatar Eric Capps avatar Evan Anger avatar  avatar Franklin avatar Olivier Refalo avatar Sven Herzberg avatar

Watchers

Sven Herzberg avatar James Cloos avatar  avatar

ayah.js's Issues

Example with Express

This is awesome!

Would it be possible to get an example of how to do this as a middleware for something like express? or perhaps you could give me a quick idea of how to do it with express, and I could make an example.

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.