Giter VIP home page Giter VIP logo

autocode-lib-node's Introduction

Autocode standard library Node.js bindings

Basic Node bindings for Autocode standard library service accession (Node 4+).

Used to interface with services built using Autocode and the Autocode CLI.

The lib package is available on npm: lib and operates as zero-dependency interface to run Autocode standard library APIs and web services. This means that you can utilize any service on Autocode without installing any additional dependencies, and when you've deployed services to Autocode, you have a pre-built Node.js SDK --- for example;

Callback Style

const lib = require('lib');
lib.yourUsername.hostStatus({name: 'Dolores Abernathy'}, (err, result) => {

  // handle result

});

Promise Style

const lib = require('lib');
lib.yourUsername.hostStatus({name: 'Dolores Abernathy'})
  .then(result => /* handle result */)
  .catch(err => /* handle error */);

To explore the Autocode standard library, visit https://autocode.com/lib/. To build a web service or standard library API, sign up on https://autocode.com/.

Installation

To install locally in a project, use;

$ npm install lib --save

Usage

const lib = require('lib');

// [1]: Call "utils.greet" function, the latest version, from Autocode
let message = await lib.utils.greet({name: 'Lionel Hutz'});

// [2]: Call "utils.greet" function with "dev" environment
let message = await lib.utils.greet['@dev']({name: 'Lionel Hutz'});

// [3]: Call "utils.greet" function with "release" environment
//      This is equivalent to (1)
let message = await lib.utils.greet['@release']({name: 'Lionel Hutz'});

// [4]: Call "utils.greet" function with specific version
//      if latest version, this is equivalent to (1)
let message = await lib.utils.greet['@0.0.1']({name: 'Lionel Hutz'});

// [5]: Call another endpoint within the "utils.greet" service
let message = await lib.utils.greet['@dev'].otherEndpoint();

// You can compose calls dynamically as well by using a string key
await lib['utils.greet']({name: 'Lionel Hutz'});
await lib['utils.greet[@dev]']({name: 'Lionel Hutz'});
await lib['utils.greet[@release]']({name: 'Lionel Hutz'});
await lib['utils.greet[@0.0.1]']({name: 'Lionel Hutz'});
await lib['utils.greet.otherEndpoint']({name: 'Lionel Hutz'});
await lib['utils.greet[@dev].otherEndpoint']({name: 'Lionel Hutz'});
await lib['utils.greet[@release].otherEndpoint']({name: 'Lionel Hutz'});
await lib['utils.greet[@0.0.1].otherEndpoint']({name: 'Lionel Hutz'});

Additional Information

To learn more about Autocode, visit autocode.com or read the Autocode CLI documentation on GitHub.

You can follow the development team on Twitter, @AutocodeHQ

Autocode is © 2016 - 2021 Polybit Inc.

autocode-lib-node's People

Contributors

keithwhor avatar jacoblee93 avatar yusuf-musleh 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.